[SERVER-739] Limits do not seem to work for Geospatial queries Created: 11/Mar/10  Updated: 17/Mar/12  Resolved: 12/Mar/10

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

Type: Bug Priority: Major - P3
Reporter: Greg White Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Linux/Ubuntu/64-bit


Participants:

 Description   

Limits do not seem to work for Geospatial queries. A count() on the returned result set always returns 100.



 Comments   
Comment by Eliot Horowitz (Inactive) [ 17/Mar/12 ]

Its an issue - just not for the reasons explained in this ticket.
See SERVER-856

Comment by Alan [ 16/Mar/12 ]

Is this really not a bug? size() behaves the same despite this from the docs "size() is like count() but takes into consideration any limit() or skip() specified for the query."

For example:

> db.geos.find({ l: { $nearSphere: [0, 51.4772220], $maxDistance: 5 } }).limit(1e6).length()
35084
> db.geos.find({ l: { $nearSphere: [0, 51.4772220], $maxDistance: 5 } }).size()
100
> db.geos.find({ l: { $nearSphere: [0, 51.4772220], $maxDistance: 5 } }).limit(101).size()
100
> db.geos.find({ l: { $nearSphere: [0, 51.4772220], $maxDistance: 5 } }).limit(99).size()
99

If nothing else it seems a bit inconsistent to me that the limits would be respected only up to a point.

Comment by Eliot Horowitz (Inactive) [ 12/Mar/10 ]

count() always returns the total number, which for geo defaults to 100
it doesn't take the limit into account

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