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

limits do not seem to work correctly in shell when count()'ing $near queries

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 1.9.1
    • Component/s: Geo
    • None
    • Query
    • ALL

      find( $near ) queries can be used correctly in the shell when returning results via a cursor, but using count() seems to ignore any limits set, defaulting the $near query to 100 objects.

      To reproduce:

      assert.eq( 200, find( { loc : { $near :

      { ... }

      } } ).limit( 200 ).count() ), where 200 docs should be returned.

      Stack trace on entry to geo code:
      command sent:
      {
      "count" : "testAllGeo",
      "query" : {
      "locs.loc" :

      { "$near" : [ 120.45922357589006, -70.7542346790433 ], "$maxDistance" : 239.56330362707376 }

      },
      "fields" : {

      },
      "limit" : 3000
      }

      0x73d712 0x717da9 0x618645 0x71aaef 0x71ad23 0x71e0e3 0x721a5b 0x722977 0x723366 0x60fc31 0x75ca58 0x75a0c4 0x75a705 0x610088 0x61266d 0x6ec978 0x81a784 0x595d40 0x7f43f5d11230 0x7f43f642c971
      /home/greg/Workspaces/Mongo Workspace/mongo/mongod(_ZNK5mongo9Geo2dType9newCursorERKNS_7BSONObjES3_i+0x52) [0x73d712]
      /home/greg/Workspaces/Mongo Workspace/mongo/mongod(_ZNK5mongo9QueryPlan9newCursorERKNS_7DiskLocEi+0x49) [0x717da9]
      /home/greg/Workspaces/Mongo Workspace/mongo/mongod(_ZN5mongo7CountOp5_initEv+0x35) [0x618645]
      /home/greg/Workspaces/Mongo Workspace/mongo/mongod(_ZN5mongo7QueryOp4initEv+0x11f) [0x71aaef]
      /home/greg/Workspaces/Mongo Workspace/mongo/mongod(_ZN5mongo12QueryPlanSet6Runner6initOpERNS_7QueryOpE+0x23) [0x71ad23]
      /home/greg/Workspaces/Mongo Workspace/mongo/mongod(_ZN5mongo12QueryPlanSet6Runner3runEv+0x3c3) [0x71e0e3]
      /home/greg/Workspaces/Mongo Workspace/mongo/mongod(_ZN5mongo12QueryPlanSet5runOpERNS_7QueryOpE+0x5b) [0x721a5b]
      /home/greg/Workspaces/Mongo Workspace/mongo/mongod(_ZN5mongo16MultiPlanScanner9runOpOnceERNS_7QueryOpE+0x537) [0x722977]
      /home/greg/Workspaces/Mongo Workspace/mongo/mongod(_ZN5mongo16MultiPlanScanner5runOpERNS_7QueryOpE+0x26) [0x723366]
      /home/greg/Workspaces/Mongo Workspace/mongo/mongod(_ZN5mongo8runCountEPKcRKNS_7BSONObjERSs+0x241) [0x60fc31]
      /home/greg/Workspaces/Mongo Workspace/mongo/mongod(_ZN5mongo8CmdCount3runERKSsRNS_7BSONObjERSsRNS_14BSONObjBuilderEb+0xc8) [0x75ca58]
      /home/greg/Workspaces/Mongo Workspace/mongo/mongod(_ZN5mongo11execCommandEPNS_7CommandERNS_6ClientEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb+0x894) [0x75a0c4]
      /home/greg/Workspaces/Mongo Workspace/mongo/mongod(_ZN5mongo12_runCommandsEPKcRNS_7BSONObjERNS_10BufBuilderERNS_14BSONObjBuilderEbi+0x345) [0x75a705]
      /home/greg/Workspaces/Mongo Workspace/mongo/mongod(_ZN5mongo11runCommandsEPKcRNS_7BSONObjERNS_5CurOpERNS_10BufBuilderERNS_14BSONObjBuilderEbi+0x38) [0x610088]
      /home/greg/Workspaces/Mongo Workspace/mongo/mongod(ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1+0x61d) [0x61266d]
      /home/greg/Workspaces/Mongo Workspace/mongo/mongod(_ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE+0xd58) [0x6ec978]
      /home/greg/Workspaces/Mongo Workspace/mongo/mongod(_ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE+0xd4) [0x81a784]
      /home/greg/Workspaces/Mongo Workspace/mongo/mongod(_ZN5mongo3pms9threadRunEPNS_13MessagingPortE+0x480) [0x595d40]
      /usr/lib/libboost_thread.so.1.42.0(thread_proxy+0x60) [0x7f43f5d11230]
      /lib/libpthread.so.0(+0x7971) [0x7f43f642c971]

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            greg_10gen Greg Studer
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: