-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
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.
- is depended on by
-
SERVER-58602 Rewrite $geoNear to $geoWithin + compute distance + $sort
- Closed
- is related to
-
SERVER-84974 Investigate $geoNear blocking sort
- Closed