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

Investigate if we should remove support for sorting by {$meta: "geoNearDistance"}

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Query Integration

      It looks to me like this support was added in SERVER-59171 in an effort to make SERVER-58602 easier. However, SERVER-58602 didn't end up using this new syntax.

      I think this is worth considering removing because "geoNearDistance" would likely want to be presented in ascending order (closest points should sort first). This is in contrast to all other types of metadata which assumed that all metadata should be sorted to return highest first (most notably text score). There is no syntactical way to get a sort by geoNearDistance to sort in any custom order (and consequently the order that makes sense). As a result, every single meta expression sorts in descending order. This is true at least for now as I file this - maybe in the future after SERVER-46298 or similar work you will be able to specify an expression and also an order.

            Assignee:
            Unassigned Unassigned
            Reporter:
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: