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

geo $near deduping is not working

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.5.5
    • Affects Version/s: 2.5.4
    • Component/s: Querying, Write Ops
    • Labels:
    • Fully Compatible
    • ALL

      Setup:

      > t = db.t
      > t.drop()
      > t.ensureIndex({locs: "2d"})
      > t.save({locs: [[49.999,49.999], [50.0,50.0], [50.001,50.001]]})
      

      The js file attached can be used for an easy repro.

      Case 1 (find):

      The following $near query should return the document just once, but instead it returns the same document three times (de-duplication has failed):

      > t.find({locs: {$near: [50.0, 50.0]}})
      { "locs" : [ [ 49.999, 49.999 ], [ 50, 50 ], [ 50.001, 50.001 ] ], "_id" : ObjectId("52af410a39870765bef3419b") }
      { "locs" : [ [ 49.999, 49.999 ], [ 50, 50 ], [ 50.001, 50.001 ] ], "_id" : ObjectId("52af410a39870765bef3419b") }
      { "locs" : [ [ 49.999, 49.999 ], [ 50, 50 ], [ 50.001, 50.001 ] ], "_id" : ObjectId("52af410a39870765bef3419b") }
      
      Case 2 (update):

      Geo $near de-duplication also seems to be causing some update()-related issues. The following multiupdate fails entirely:

      t.update({locs: {$near: [50.0, 50.0]}}, {$inc: {touchCount: 1}}, false, true)
      Update WriteResult({
      	"ok" : 0,
      	"code" : 1,
      	"errmsg" : " Update query failed -- RUNNER_ERROR",
      	"n" : 0
      })
      

      The expected result is that the update() succeeds and that touchCount is set to a value of 1.

        1. geo_update_dedup.js
          2 kB
        2. update_geo_dedup.js
          2 kB

            Assignee:
            benety.goh@mongodb.com Benety Goh
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: