Chapter 3 insert order quiz answer incorrect only 1, 4 correct

db.pets.insert([ { “_id”: 1, “pet”: “cat”},
… { “_id”: 1, “pet”: “dog”},
… { “_id”: 3, “pet”: “fish”},
… { “_id”: 4, “pet”: “snake” }], {“ordered”: false })
BulkWriteResult({
“writeErrors” : [
{
“index” : 0,
“code” : 11000,
“errmsg” : “E11000 duplicate key error collection: pet.pets index: id dup key: { _id: 1.0 }”,
“op” : {
“_id” : 1,
“pet” : “cat”
}
},
{
“index” : 1,
“code” : 11000,
“errmsg” : “E11000 duplicate key error collection: pet.pets index: id dup key: { _id: 1.0 }”,
“op” : {
“_id” : 1,
“pet” : “dog”
}
},
{
“index” : 2,
“code” : 11000,
“errmsg” : “E11000 duplicate key error collection: pet.pets index: id dup key: { _id: 3.0 }”,
“op” : {
“_id” : 3,
“pet” : “fish”
}
}
],
“writeConcernErrors” : ,
“nInserted” : 1,
“nUpserted” : 0,
“nMatched” : 0,
“nModified” : 0,
“nRemoved” : 0,
“upserted” :

It looks like you did not empty you collection between each of your trials to satisfy the part of the question that say: into an empty pets collection.

Because if the collection is empty there is no way to get E11000 twice for _id:1.

1 Like

Hi @Raj_Neerohoo ,

Let us know if you are still facing any issues.