Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-1821

Cannot update a collection using $inc modifier using a geo $center query unless the fields already exist in the matched documents

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.7.4
    • Affects Version/s: 1.6.2
    • Component/s: Geo
    • None
    • Environment:
      OSX 64bit, Snow Leopard, Macbook
    • ALL

      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

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            smurphy Sam Murphy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: