[SERVER-2735] Use $maxDistance as limiter when performing near queries Created: 10/Mar/11  Updated: 29/Aug/11  Resolved: 10/Mar/11

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

Type: Improvement Priority: Major - P3
Reporter: Justin Palmer Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

In order to support counting points within a certain distance, $maxDistance should take precedence over the current 100 result limit. To illustrate my own problem, I'd like to count how many crimes happened within a certain range of a particular point. As long as the results are below 100, this query will return the expected result, anything with more than 100 results always returns 100.

db.crimes.count({loc:

{ $near: [-122.578997, 45.533723], $maxDistance: 0.005}

, reported_at: {$gte: new Date("Jan 01, 2009"), $lt: new Date("Jan 01, 2010")}



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

You should use $within center

http://www.mongodb.org/display/DOCS/Geospatial+Indexing#GeospatialIndexing-BoundsQueries

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