[SERVER-6659] findAndModify errors when upserting on non-existent document and original query can't find doc Created: 31/Jul/12 Updated: 11/Jul/16 Resolved: 01/Aug/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Write Ops |
| Affects Version/s: | 2.1.0, 2.1.1, 2.1.2, 2.2.0-rc0 |
| Fix Version/s: | 2.2.0-rc1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Remon van Vliet | Assignee: | Eliot Horowitz (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | findAndModify | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
All |
||
| Backwards Compatibility: | Major Change |
| Operating System: | ALL |
| Participants: |
| Description |
|
The following findAndModify succeeds on 2.0 and lower and fails on 2.1 and higher : db.test.findAndModify({query: {f:1}, update:{$set:{f:2}}, upsert:true, new:true}) With the following (somewhat vague) error : uncaught exception: findAndModifyFailed failed: "exception: assertion src\\mongo\\db\\commands The expected behaviour would be that this operation returns { "_id" : ... , "f" : 2 }but as shown it fails. |
| Comments |
| Comment by auto [ 01/Aug/12 ] | |||||||||||||||||||||||||
|
Author: {u'date': u'2012-07-31T23:15:15-07:00', u'email': u'eliot@10gen.com', u'name': u'Eliot Horowitz'}Message: | |||||||||||||||||||||||||
| Comment by Remon van Vliet [ 31/Jul/12 ] | |||||||||||||||||||||||||
|
Confirmed. I should've added a bit more description | |||||||||||||||||||||||||
| Comment by Ian Whalen (Inactive) [ 31/Jul/12 ] | |||||||||||||||||||||||||
|
thanks for catching that remon. can you confirm it's just upserting on non-existing doc that fails for you? upsertng against an existing doc appears to work on my end. | |||||||||||||||||||||||||
| Comment by Remon van Vliet [ 31/Jul/12 ] | |||||||||||||||||||||||||
|
Noticed the issue name change. The issue is not related to the collection existing or not. : mongos> db.test.save({}) , update:{$set:{f:2}}, upsert:true, new:true}) | |||||||||||||||||||||||||
| Comment by Kristina Chodorow (Inactive) [ 31/Jul/12 ] | |||||||||||||||||||||||||
|
To reproduce:
Output:
|