[SERVER-2997] limits do not seem to work correctly in shell when count()'ing $near queries Created: 25/Apr/11  Updated: 06/Dec/22  Resolved: 15/Mar/17

Status: Closed
Project: Core Server
Component/s: Geo
Affects Version/s: 1.9.1
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Greg Studer Assignee: Backlog - Query Team (Inactive)
Resolution: Done Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-856 Geospatial result paging fails when s... Closed
is related to SERVER-5236 $near query should return results pro... Closed
is related to SERVER-14515 Remove default limit from geoNear ope... Closed
Assigned Teams:
Query
Operating System: ALL
Participants:

 Description   

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]



 Comments   
Comment by David Storch [ 15/Mar/17 ]

This issue no longer reproduces against a recent build of the master branch. I'm resolving as Gone Away. I believe, but have not confirmed, that this was fixed under SERVER-14515.

Comment by Greg Studer [ 28/Jun/11 ]

Check at same time

Generated at Thu Feb 08 03:01:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.