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

Expose computeGeoNearDistance() as an internal-only DocumentSource

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

      $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.

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

              Created:
              Updated:
              Resolved: