[SERVER-14329] 2d queries with skip and limit don't behave as expected Created: 20/Jun/14  Updated: 10/Dec/14  Resolved: 07/Jul/14

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

Type: Bug Priority: Major - P3
Reporter: Doron Pagot Assignee: Siyuan Zhou
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-14039 $nearSphere query with 2d index, skip... Closed
Operating System: ALL
Steps To Reproduce:

to reproduce (in mongo client):

    db.test.drop();
    db.test.ensureIndex({point: "2d"});
    for (var i = 0; i < 200; ++i) { 
      db.test.insert({point:[1,2]});
    }
    db.test.insert({point:[1,2.01]});
    db.test.find({point: {$nearSphere: [1,2]}}).skip(200).limit(201);

returns:

> { "_id" : ObjectId("53a476c6c83c83ebdd121038"), "point" : [ 1, 2.01 ] }

when you

    db.test.find({point: {$nearSphere: [1,2]}}).skip(200).limit(1);

there's nothing.

Participants:

 Description   

when you skip '2d' geo queries, the limit starts from the start and not from the skip. for example, skip 100, limit 1 will always return nothing, but skip 100, limit 101 will return a single value (if exists)



 Comments   
Comment by Doron Pagot [ 20/Jun/14 ]

http://stackoverflow.com/questions/24332586/mongodb-nearsphere-with-skip-and-limit-in-2-4-3-vs-2-6-1/24333154#24333154

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