[SERVER-14493] mongodb 2.6.3 when use geosearch ,skip() function return unexpected data Created: 08/Jul/14  Updated: 10/Dec/14  Resolved: 08/Jul/14

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

Type: Bug Priority: Major - P3
Reporter: XueJian Assignee: Unassigned
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
Participants:

 Description   

without geosearch , skip(2).limit(2) return the right data:

> db.pois.find( {city_code:'420100' }  ).limit(2)
{ "_id" : ObjectId("5361152edd837157d70aa2f0"), "name" : "简朴人家(才华街店)", "address" : "武汉市武昌区才华街2号(和平大道路口)", "phone" : "027-50860989", "coordinate" : [ 114.34124, 30.596979 ], "city_code" : "420100" }
{ "_id" : ObjectId("5361152edd837157d70aa2f1"), "name" : "韩汉宫", "address" : "武汉市硚口区解放大道628号新世界百货K11新食艺B1楼食通天美食广场(近青年路)", "phone" : "", "coordinate" : [ 114.264922, 30.579027 ], "city_code" : "420100" }
>  db.pois.find( {city_code:'420100' }  ).skip(2).limit(2)
{ "_id" : ObjectId("5361152edd837157d70aa2f2"), "name" : "桂香园", "address" : "武汉市洪山区珞喻路152号华中师范大学桂中路(近卓刀泉南路)", "phone" : "", "coordinate" : [ 114.357586, 30.518095 ], "city_code" : "420100" }
{ "_id" : ObjectId("5361152edd837157d70aa2f3"), "name" : "香侬果品(赵家条店)", "address" : "武汉市江岸区永清路61号(近惠济路)", "phone" : "027-82865551,81888826", "coordinate" : [ 114.298548, 30.614515 ], "city_code" : "420100" }

But with geo search ,skip will skip from the final result, means the document number you get is " (limit number) - (skip number) ".

> db.pois.find({city_code:'420100',coordinate:{"$near": [114.343132,30.556547]}}).skip(2).limit(2)
> db.pois.find({city_code:'420100',coordinate:{"$near": [114.343132,30.556547]}}).skip(2).limit(3)
{ "_id" : ObjectId("53611530dd837157d70aac3b"), "name" : "荆门美食会所", "address" : "武汉市武昌区武昌中北路同成富苑117号(同成大厦旁)", "phone" : "027-87253386", "coordinate" : [ 114.343359, 30.557116 ], "city_code" : "420100" }



 Comments   
Comment by Thomas Rueckstiess [ 08/Jul/14 ]

Closing as duplicate of SERVER-14039

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