MongoDB
C100DBA · Question #45
What is the output of following two commands in MongoDB: db. posts. insert({n_id":l}) db.posts.insert({"_id":l})
Sign in or unlock C100DBA to reveal the answer and full explanation for question #45. The question stem and answer options stay visible for context.
MongoDB Fundamentals
Question
What is the output of following two commands in MongoDB: db. posts. insert({n_id":l}) db.posts.insert({"_id":l})
Options
- ATwo documents will be inserted with _id as 1
- BMongoDB will automatically increment the _id of the second document as 2
- CThis will throw a duplicate key error
- DIt will insert two documents and throw a warning to the user
Unlock C100DBA to see the answer
You've previewed enough free C100DBA questions. Unlock C100DBA for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.
Topics
#_id field#duplicate key error#document insertion#unique index