[SERVER-4163] findAndModify returns an empty document with "new" : true flag if the _id value in the query document does not match the _id value in the update document. Created: 27/Oct/11 Updated: 07/Mar/14 Resolved: 18/Sep/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Write Ops |
| Affects Version/s: | 1.8.4, 2.0.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Barrie Segal | Assignee: | Eliot Horowitz (Inactive) |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | find | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Operating System: | ALL | ||||||||
| Participants: | |||||||||
| Description |
|
This is related to https://jira.mongodb.org/browse/SERVER-4157 If the _id value in the query document does not match the _id value in the update document, an empty document will be returned. To reproduce: (in 1.8.4 or 2.0.1) > db.test.drop() , "update" : { "_id" : 1, "name" : "Object 1"}, "upsert" : true, "new" : true } ); > db.test.findAndModify({ "query" : { "_id" : 2, name:"blah"}, "update" : { "_id" : 2, "name" : "Object 2"}, "upsert" : true, "new" : true } ); { "_id" : 2, "name" : "Object 2" } // the expected document is returned |