-
Type: Improvement
-
Resolution: Done
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Geo
-
None
We're currently using $near to query our geo spatial collections which uses the order lat, lon. We need to switch to $nearSphere to make sure results are ordered by distance, which they aren't when using $near due to it not being spherical.
Currently $nearSphere requires the indexed field to be in order of lon, lat. I would rather not change the order of all our collections from lat, lon to lon, lat as it would introduce all sorts of issues down the line in the code bases accessing the collections.
Is there anyway the order of the geo coordinates could be configured or customized? If not perhaps you could create another spherical query that is using lat, lon.