[SERVER-1777] Assertion error in findAndModify Created: 11/Sep/10 Updated: 14/Sep/18 Resolved: 23/Sep/10 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 1.6.2 |
| Fix Version/s: | 1.7.1 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | A. Jesse Jiryu Davis | Assignee: | Mathias Stearn |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Linux 64 |
||
| Operating System: | ALL |
| Participants: |
| Description |
|
On empty DB, I'm trying to ensure that I insert exactly one record like this: { short_code: 1 }... and that concurrent processes doing the same thing will instead increment the short_code. > db.runCommand({findAndModify: 'short_code', upsert: true, update: { $inc: { short_code: 1 }}, query: { short_code: true }, new: true }) |
| Comments |
| Comment by Mathias Stearn [ 23/Sep/10 ] |
|
The issue was that you were seeding with short_code:true and you can't $inc a boolean value in mongo. Of course the error was being swallowed in the command so you never saw it. Now it will return an error. |
| Comment by auto [ 23/Sep/10 ] |
|
Author: {'login': 'RedBeard0531', 'name': 'Mathias Stearn', 'email': 'mathias@10gen.com'}Message: Pass through update error messages in findAndModify |