[SERVER-34245] Save shell command allows multiple documents to be inserted Created: 30/Mar/18 Updated: 29/Oct/23 Resolved: 21/Nov/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | None |
| Fix Version/s: | 6.3.0-rc0 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Naynish Chaughule | Assignee: | Sebastien Mendez |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | neweng, query-44-grooming | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Studio 3T for MongoDB |
||
| Backwards Compatibility: | Fully Compatible |
| Sprint: | QE 2022-11-14, QE 2022-11-28 |
| Participants: |
| Description |
|
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
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.
If I save just a single document then the upsert works as expected
Why is it allowed to upsert multiple documents? |
| Comments |
| Comment by Githook User [ 21/Nov/22 ] | ||||||||||||||
|
Author: {'name': 'Sebastien Mendez', 'email': 'sebastien.mendez@mongodb.com', 'username': 'rakiz'}Message: | ||||||||||||||
| Comment by Asya Kamsky [ 03/Apr/18 ] | ||||||||||||||
|
Shell save method should give an error when passed "array" type, which it currently does not.
There should probably be an additional check that if it's an object it's not an array. Leaving in "Needs Triage" since I'm not sure if the query or platform team should own this. |