Ordered option in insert command

This insert command -

db.inspections.insert([{"_id" : 1, “test” : 1}, {"_id" : 1, “test” : 2}, {"_id" : 3, “test” : 3}])

is inserting {"_id" : 1} document which is understandable.

And another one -

db.inspections.insert([{"_id" : 1, “test” : 1}, {"_id" : 1, “test” : 2}, {"_id" : 3, “test” : 3}], { “ordered” : false})

should actually create {"_id" : 3, “test” : 3} document, according to the instruction video but instead I’m getting error and the document with “_id” value 3 is not getting inserted.

Can someone help me to understand this. I’m not able to figure out.

attaching the screenshot -

You ran ordered=false rather than ordered:false.

2 Likes

Oh god :pensive: I’m feeling so embarassed by asking this question. Any way thank you so much :blush:

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.