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

geo query with explicit skip and no explicit limit returns no results

    XMLWordPrintableJSON

Details

    • Icon: Question Question
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Geo
    • None

    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 )
      >

      Attachments

        Activity

          People

            Unassigned Unassigned
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: