[SERVER-5390] geo query with explicit skip and no explicit limit returns no results Created: 23/Mar/12  Updated: 15/Feb/13  Resolved: 17/Jan/13

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

Type: Question Priority: Major - P3
Reporter: Aaron Staple Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-6138 skip does not skip on a '2d' near sea... Closed
Participants:

 Description   

There is a default limit of 100 results for a geo query. But when a skip or limit is supplied skip + limit results are returned. When skip is supplied but limit is not supplied, a limit of 0 is used and no results are returned.

> c.ensureIndex( { a:'2d' } )
> c.save( { a:[ 0, 0 ] } )
> c.save( { a:[ 0, 0 ] } )
> c.find( { a:{ $near:[ 0, 0 ] } } )
{ "_id" : ObjectId("4f6d0ac3da35890a46b4b213"), "a" : [ 0, 0 ] }
{ "_id" : ObjectId("4f6d0ac4da35890a46b4b214"), "a" : [ 0, 0 ] }
> c.find( { a:{ $near:[ 0, 0 ] } } ).skip( 1 ).limit( 1 )
{ "_id" : ObjectId("4f6d0ac4da35890a46b4b214"), "a" : [ 0, 0 ] }
> c.find( { a:{ $near:[ 0, 0 ] } } ).skip( 1 )
>



 Comments   
Comment by Eliot Horowitz (Inactive) [ 17/Jan/13 ]

SERVER-5800

Comment by hari.khalsa@10gen.com [ 14/Jan/13 ]

See https://jira.mongodb.org/browse/SERVER-5390

Comment by auto [ 07/Apr/12 ]

Author:

{u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}

Message: SERVER-5390 Identify issue in the code.
Branch: master
https://github.com/mongodb/mongo/commit/84a160ca6823782b6b3ca6268d4a5cd1e7aeba28

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