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

Geo Query with $within and {$uniqueDocs:false} does not return matched documents multiple times.

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.5.3
    • Component/s: Querying
    • None
    • Environment:
      Linux.
    • Major Change
    • ALL
    • Hide
      MongoDB shell version: 2.5.3
      connecting to: test
      Server has startup warnings: 
      2013-11-02T14:55:59.666-0400 [initandlisten] 
      2013-11-02T14:55:59.666-0400 [initandlisten] ** NOTE: This is a development version (2.5.3) of MongoDB.
      2013-11-02T14:55:59.666-0400 [initandlisten] **       Not recommended for production.
      2013-11-02T14:55:59.666-0400 [initandlisten] 
      > 
      > db.geo.createIndex( { p : "2d" } )
      > db.geo.insert( { p : [ [ 5, 5 ], [ 6, 6 ] ] } )
      > db.geo.insert( { p : [8,8] } )
      > db.geo.insert( { p : [4,4] } )
      > db.geo.find( { p : { "$within" : { "$box" : [ [3, 3], [7,7] ], "$uniqueDocs" : false } } } )
      { "_id" : ObjectId("52754c0c5d197882730594ab"), "p" : [  [  5,  5 ],  [  6,  6 ] ] }
      { "_id" : ObjectId("52754c305d197882730594ad"), "p" : [  4,  4 ] }
      
      // Should have returned the first document (52754c0c5d197882730594ab) twice.
      
      Show
      MongoDB shell version: 2.5.3 connecting to: test Server has startup warnings: 2013-11-02T14:55:59.666-0400 [initandlisten] 2013-11-02T14:55:59.666-0400 [initandlisten] ** NOTE: This is a development version (2.5.3) of MongoDB. 2013-11-02T14:55:59.666-0400 [initandlisten] ** Not recommended for production. 2013-11-02T14:55:59.666-0400 [initandlisten] > > db.geo.createIndex( { p : "2d" } ) > db.geo.insert( { p : [ [ 5, 5 ], [ 6, 6 ] ] } ) > db.geo.insert( { p : [8,8] } ) > db.geo.insert( { p : [4,4] } ) > db.geo.find( { p : { "$within" : { "$box" : [ [3, 3], [7,7] ], "$uniqueDocs" : false } } } ) { "_id" : ObjectId("52754c0c5d197882730594ab"), "p" : [ [ 5, 5 ], [ 6, 6 ] ] } { "_id" : ObjectId("52754c305d197882730594ad"), "p" : [ 4, 4 ] } // Should have returned the first document (52754c0c5d197882730594ab) twice.

      The semantics for 2.5.3 for a geo query using a '2d' index have changed when requesting that documents matching the region multiple times be returned multiple times.

      While

            Assignee:
            gianfranco Gianfranco Palumbo
            Reporter:
            robert.j.moore@allanbank.com Robert Moore
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: