objects with array of locations returned multiple times in geo search

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Geo
    • None
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      > db.foo.drop()
      true
      > for (var i=0; i<100; i+) for (var j=0; j<100; j+) db.foo.insert({locs:{loc:[[i+Math.random(), j+Math.random()],[i+Math.random(), j+Math.random()],[i+Math.random(), j+Math.random()],[i+Math.random(), j+Math.random()],[i+Math.random(), j+Math.random()],]}})
      > db.foo.ensureIndex(

      {'locs.loc':'2d'}

      )
      > db.foo.find({'locs.loc': {$near: [50,50]}}, {_id:1}).limit(10)

      { "_id" : ObjectId("4e5e9db248cf912e7af1a478") } { "_id" : ObjectId("4e5e9db248cf912e7af1a414") } { "_id" : ObjectId("4e5e9db248cf912e7af1a414") } { "_id" : ObjectId("4e5e9db248cf912e7af1a478") } { "_id" : ObjectId("4e5e9db248cf912e7af1a414") } { "_id" : ObjectId("4e5e9db248cf912e7af1a415") } { "_id" : ObjectId("4e5e9db248cf912e7af1a479") } { "_id" : ObjectId("4e5e9db248cf912e7af1a478") } { "_id" : ObjectId("4e5e9db248cf912e7af1a479") } { "_id" : ObjectId("4e5e9db248cf912e7af1a415") }

      Note that we do dedupe on normal indexes:
      > db.bar.insert(

      {a:[1,2,3,4]}

      )
      > db.bar.insert(

      {a:[1,2,3,4]}

      )
      > db.bar.find({a:{$in:[1,2,3,4]}})

      { "_id" : ObjectId("4e5e9ee648cf912e7af1b7d0"), "a" : [ 1, 2, 3, 4 ] } { "_id" : ObjectId("4e5e9ee848cf912e7af1b7d1"), "a" : [ 1, 2, 3, 4 ] }

            Assignee:
            Greg Studer (Inactive)
            Reporter:
            Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: