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

geo $near deduping is not working

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 2.5.4
    • 2.5.5
    • Querying, Write Ops
    • Fully Compatible
    • ALL

    Description

      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.

      Attachments

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

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: