-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.4.6
-
Component/s: Index Maintenance
-
ALL
-
Sorting a result by a single field on a find() or aggregate() result that uses geoNear or geoWithin and limiting the result (e.g. to 1,000 documents) yields a very slow response time. Running explain shows scanAndOrder=true and a very high number of scanned documents.
If you remove the geoNear/geoWithin and get the whole collection, the sort is very fast, and explain shows scanAndOrder=false and a number of low number of scanned documents, which is equal to the limit specified.