Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-6853

Make order of geo coordinates customizable when querying using $nearSphere

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Geo
    • Labels:
      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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            fbjork Fredrik Björk
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: