Skip to content

Instantly share code, notes, and snippets.

@smurphy
Created September 21, 2010 01:11
Show Gist options
  • Save smurphy/588981 to your computer and use it in GitHub Desktop.
Save smurphy/588981 to your computer and use it in GitHub Desktop.
db.createCollection("points");
db.points.ensureIndex( { loc : "2d" } )
for(var x = 0; x < 10; x = x + 1) {
for(var y = 0; y < 10; y = y + 1) {
db.points.insert({"loc": [x, y]});
}
}
// Run geo $inc
db.points.update({"loc" : {"$within" : {"$center" : [[5,5], 2]}}}, {'$inc' : { 'test' : 1}}, false, true);
/////////////////
// FAILS:
// 0x10006e90b 0x10007d47c 0x10015fc70 0x100161759 0x100269532 0x10026b319 0x1003a5822 0x1003b6d84 0x7fff884fa8b6 0x7fff884fa769
// 0 mongod 0x000000010006e90b _ZN5mongo12sayDbContextEPKc + 171
// 1 mongod 0x000000010007d47c _ZN5mongo8assertedEPKcS1_j + 284
// 2 mongod 0x000000010015fc70 _ZN5mongo14_updateObjectsEbPKcRKNS_7BSONObjES2_bbbRNS_7OpDebugEPNS_11RemoveSaverE + 6864
// 3 mongod 0x0000000100161759 _ZN5mongo13updateObjectsEPKcRKNS_7BSONObjES2_bbbRNS_7OpDebugE + 313
// 4 mongod 0x0000000100269532 _ZN5mongo14receivedUpdateERNS_7MessageERNS_5CurOpE + 1170
// 5 mongod 0x000000010026b319 _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_8SockAddrE + 5513
// 6 mongod 0x00000001003a5822 _ZN5mongo10connThreadEPNS_13MessagingPortE + 546
// 7 mongod 0x00000001003b6d84 thread_proxy + 132
// 8 libSystem.B.dylib 0x00007fff884fa8b6 _pthread_start + 331
// 9 libSystem.B.dylib 0x00007fff884fa769 thread_start + 13
// Mon Sep 20 19:08:35 [conn7] Caught Assertion in update , continuing
// Run a non-geo $inc
db.points.update({}, {'$inc' : { 'test' : 1}}, false, true);
// No error
// Re-run geo $inc
db.points.update({"loc" : {"$within" : {"$center" : [[5,5], 2]}}}, {'$inc' : { 'test' : 1}}, false, true);
// No error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment