[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
an update in Mongo. This was a working query and now it fails.

> 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
"Tue Dec 7 16:10:12 [conn4] update liststore.individuals query:

{ a.b: 665.0 }

exception 10144 can't apply mod in place - shouldn't
have gotten here 0ms"

"a.b" is an indexed long
"c" is a collection containing an array
"d" is a field for each document within "c"

OS: Debian x64
Mongo: 1.6.4

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.

Generated at Thu Feb 08 02:59:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.