[SERVER-8390] If you call count on a $near query it looks at all points, and is slow. Created: 29/Jan/13  Updated: 30/Jan/13  Resolved: 30/Jan/13

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

Type: Bug Priority: Major - P3
Reporter: Ian Bentley Assignee: hari.khalsa@10gen.com
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

Working with ny openstreetview data (can be found in mongo-snippets/2dsphere/data) which results in 366440 entries.

When doing a db.ny.find().count(), it returns instantly.

If I do a db.ny.find({geo: {$near: {$geometry: {type: "Point", coordinates [any lng, lat ]}}}}).count()

it hangs for a long time, and eats all of my memory.



 Comments   
Comment by hari.khalsa@10gen.com [ 30/Jan/13 ]

I tested this locally. Doesn't seem to eat memory, does take a while though, but I think that's by design – you don't want to do a count on a find like that

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