-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Minor - P4
-
Affects Version/s: None
-
Component/s: Shell
-
Environment:Studio 3T for MongoDB
-
Fully Compatible
-
QE 2022-11-14, QE 2022-11-28
-
None
-
0
-
None
-
None
-
None
-
None
-
None
-
None
According to this article https://docs.mongodb.com/manual/reference/method/db.collection.save/
save does not support an array of documents but I could insert multiple documents as follows
db.test.save( [ { "_id": 1, "fruit": "apple" }, { "_id": 2, "fruit": "banana" } ] )
Now if I run the below command to add '123' at the end of the fruit names, then the save throws duplicate key error. In fact this should have been an upsert since the '_id's are the same.
db.test.save( [ { "_id": 1, "fruit": "apple 123" }, { "_id": 2, "fruit": "banana 123" } ] )
If I save just a single document then the upsert works as expected
Unable to find source-code formatter for language: mongo. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
db.test.save( { "_id": 1, "fruit": "apple 123" } )
Why is it allowed to upsert multiple documents?