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

Expose computeGeoNearDistance() as an internal-only DocumentSource

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.1.0-rc0
    • Component/s: None
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Sprint:
      Query Optimization 2021-07-26, Query Optimization 2021-08-09, QO 2021-08-23

      Description

      $geoNear sorts documents by their distance from a given query point. Conceptually it both:
      1. computes the distance, storing the result in the document metadata
      2. sorts by that distance

      The second step we can already express with $sort $meta.

      Let's expose the first step as a new internal DocumentSource. The syntax might look something like this:

      {$_internalComputeGeoNearDistance: {
        near: <point>,
        key: <fieldname>,
      }}
      

      Then a future ticket (SERVER-58602) can use this to allow $geoNear to execute anywhere in a pipeline.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ruoxin.xu Ruoxin Xu
              Reporter:
              david.percy David Percy
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: