Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-411

unable to obtain more than 100 results using Criteria#near

    • Type: Icon: Task Task
    • Resolution: Done
    • 2.1.8
    • Affects Version/s: None
    • Component/s: None

      docs say 100 is default, but limit fails to override the default.

      ruby-1.9.2-p0 > User.near(:latlng => [37.74615865877938,
      -122.44619467480469, 0.05]).all.count

      => 100

      ruby-1.9.2-p0 > User.near(:latlng => [37.74615865877938,
      -122.44619467480469, 0.05]).limit(200).all.count

      => 100

      ruby-1.9.2-p0 > User.near(:latlng => [37.74615865877938,
      -122.44619467480469, 0.05]).limit(20).all.count

      => 100


      http://www.mongodb.org/display/DOCS/Geospatial+Indexing
      db.places.find( { loc :

      { $near : [50,50] }

      } )
      The above query finds the closest points to (50,50) and returns them
      sorted by distance (there is no need for an additional sort
      parameter). Use limit() to specify a maximum number of points to
      return (a default limit of 100 applies if unspecified):
      db.places.find( { loc :

      { $near : [50,50] }

      } ).limit(20)

            Assignee:
            Unassigned Unassigned
            Reporter:
            robj rob jennings
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: