Recall & Review
beginner
What does inserting with arrays mean in MongoDB?
It means adding multiple documents at once by passing an array of objects to the insertMany() method.
Click to reveal answer
beginner
How do you insert multiple documents in MongoDB using an array?
Use the insertMany() method and pass an array of documents as the argument.
Click to reveal answer
beginner
What is the difference between insertOne() and insertMany() in MongoDB?
insertOne() adds a single document, while insertMany() adds multiple documents using an array.
Click to reveal answer
intermediate
Can you insert an empty array of documents in MongoDB?
No, inserting an empty array with insertMany() will not add any documents; the operation succeeds without error.
Click to reveal answer
intermediate
What happens if one document in the array fails to insert in insertMany()?
By default, insertMany() stops and returns an error; you can set ordered:false to continue inserting others.
Click to reveal answer
Which MongoDB method inserts multiple documents at once?
✗ Incorrect
insertMany() is the correct method to insert multiple documents using an array.
What type of argument does insertMany() expect?
✗ Incorrect
insertMany() expects an array of document objects to insert multiple documents.
If one document fails during insertMany(), what happens by default?
✗ Incorrect
By default, insertMany() stops and returns an error if any document fails.
Which option allows insertMany() to continue inserting after an error?
✗ Incorrect
Setting ordered:false allows insertMany() to continue inserting documents even if some fail.
Can you insert an empty array with insertMany()?
✗ Incorrect
Inserting an empty array does nothing; no documents are added.
Explain how to insert multiple documents in MongoDB using arrays.
Think about the method name and what it expects as input.
You got /4 concepts.
Describe what happens if one document in an insertMany array fails to insert.
Consider the default behavior and how to change it.
You got /3 concepts.