[SERVER-2192] $pop causes "can't apply mod in place - shouldn't have gotten here " - need to fix error message Created: 08/Dec/10 Updated: 18/Apr/15 Resolved: 18/Apr/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Usability |
| Affects Version/s: | 1.6.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Ben Roubicek | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
OS: Debian x64 |
||
| Operating System: | ALL |
| Participants: |
| Description |
|
During the past week I have started getting this error when performing > db.mycollection.update( { "a.b" : 665 }, { $pop : { "c" : { "d" : 1153 }} }); "can't apply mod in place - shouldn't have gotten here" mongo.log shows the following exception 10144 can't apply mod in place - shouldn't "a.b" is an indexed long OS: Debian x64 Answer: Turns out that $pull, should be used instead of $pop. The error message was not clear and could use a little attention |
| Comments |
| Comment by Scott Hernandez (Inactive) [ 18/Apr/15 ] |
|
I believe this has gone away with recent (2.6) work done to the update system. This error message has definitely been removed, and the new messages include more context on error for how they have failed or what needs to be done (where obvious). |
| Comment by Paul Miller [ 03/May/11 ] |
|
I'm having this problem too. In my case $pull doesn't help because I really do want to $pop. I find I can reproduce this bug when the array is empty. It's simple to work around though. I simply catch the error and assume it means the array is empty. |