[SERVER-19303] $pull is pulling only in last occurence of query,db.getCollection('sid').update({_id:1},{$pull:{array1:"sid"},$pull:{array2:"kp"}}) Created: 07/Jul/15 Updated: 07/Jul/15 Resolved: 07/Jul/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Write Ops |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | siddharth jain | Assignee: | Sam Kleinman (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Description |
|
Pull operation works only on one array even called twice over a document Over this document { "_id" : 1, "array1" : [ "sid", "yd" ], "array2" : [ "ram", "kp" ] }I have run following query db.getCollection('sid').update({_id:1},{$pull: {array1:"sid"},$pull:{array2:"kp"}}) result: { "_id" : 1, "array1" : [ "sid", "yd" ], "array2" : [ "ram" ] } |
| Comments |
| Comment by Sam Kleinman (Inactive) [ 07/Jul/15 ] | |||
|
I believe that one of the following operation will accomplish the update that you're looking for. I've opened
Be aware that JSON documents (as in the shell,) and BSON documents as translated by most drivers require that all keys in a document must be unique (i.e. $pull must appear only once in the update specification.) Cheers, |