Chapter 3: Creating and Manipulating Documents

IN Quiz: Insert Order. I think the 2nd option in the attached image is not correct, please check, verify and explain.

db.pets.insert([{ “_id”: 1, “pet”: “cat” },
{ “_id”: 2, “pet”: “dog” },
{ “_id”: 3, “pet”: “fish” },
{ “_id”: 3, “pet”: “snake” }])

If same version of the course as mine, the question was:

Which of the following commands will successfully insert 3 new documents into an empty pets collection?

Why do you think that the given insert() will not insert 3 documents?

If you try it, you will see BulkWriteResult.nInserted : 3.

1 Like

Hi @Ankit_Gupta1,

I hope you found @steevej-1495’s response helpful and your doubts are resolved now.

Let us know if you have any other questions.

~ Shubham

1 Like