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

mongodb 2.6.3 when use geosearch ,skip() function return unexpected data

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Geo
    • None
    • ALL

      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" }
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            xeroth XueJian
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: