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

objects with array of locations returned multiple times in geo search

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Geo
    • None
    • ALL

    Description

      > 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 ] }

      Attachments

        Activity

          People

            greg_10gen Greg Studer
            mathias@mongodb.com Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: