C100DEV CRUD Operations Practice Question
A sensor platform writes readings to the 'readings' collection. A developer needs to insert three documents in a single operation and have the server process them in the given order, stopping at the first error rather than continuing. Which insert command should be used?
⚠ Common exam trap
The trap here is forgetting that insertMany() is ordered by default and that ordered:false deliberately continues after errors.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
db.readings.insertMany([doc1, doc2, doc3], { ordered: true })
An ordered insertMany() writes documents in sequence and stops at the first error, matching the requirement. Unordered insertion continues past failures, insertOne() handles only one document, and bulkWrite() is intended for mixed operations and here omits a document.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
db.readings.insertMany([doc1, doc2, doc3], { ordered: true })
Why this is correct
insertMany() with ordered set to true inserts documents sequentially and halts on the first failure, leaving subsequent documents unprocessed. Since ordered defaults to true, this explicitly satisfies the requirement to stop at the first error. It is the correct choice when insertion sequence matters and partial success is acceptable only up to the failing document.
- ✗
db.readings.insertMany([doc1, doc2, doc3], { ordered: false })
Why it's wrong here
Setting ordered to false tells the server to continue inserting the remaining documents even if one fails, which directly contradicts the requirement to stop at the first error. It is useful for bulk loads where maximum throughput matters, but here it would let later readings be written after a failure, producing unexpected partial data.
- ✗
db.readings.insertOne([doc1, doc2, doc3])
Why it's wrong here
insertOne() accepts a single document, not an array of documents. Passing an array would either be rejected or store the array as one document's value, depending on how it is interpreted, which is not the intended batch insert. It cannot perform a three-document ordered insert in one command.
- ✗
db.readings.bulkWrite([{ insertOne: { document: doc1 } }, { insertOne: { document: doc2 } }])
Why it's wrong here
bulkWrite() can insert documents but requires wrapping each in an insertOne operation object, and it is designed for mixed operation types. Here it also omits the third document, so it does not meet the requirement. While bulkWrite supports ordered execution by default, insertMany() is the simpler and correct fit for a pure multi-document insert.
About these practice questions
One of 259 original C100DEV practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official MongoDB exam blueprint
This C100DEV practice question is part of Courseiva's free MongoDB certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the C100DEV exam.