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.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 2.5.3
    • Fix Version/s: None
    • Component/s: Querying
    • Labels:
      None
    • Environment:
      Linux.
    • Backwards Compatibility:
      Major Change
    • Operating System:
      ALL
    • Steps To Reproduce:
      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.

      Description

      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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: