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

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

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

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

            Assignee:
            Unassigned Unassigned
            Reporter:
            aaron Aaron Staple (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: