|
After SERVER-58602, a $geoNear stage operating on time-series measurement field is implemented as separate stages for the filtering, projection, and sort. The 'maxDistance' argument becomes a $geoWithin predicate, which can generate index bounds when a 2d or 2dsphere index is available.
We could do something similar for 'minDistance'. A few ideas are:
- For a spherical query, create an "inside-out" $geoWithin: center it around an antipodal point, with a radius of pi - minDistance.
- For a flat query, create a negated $geoWithin. Use a slightly smaller radius, perhaps (minDistance * (1 - epsilon)), to avoid excluding points exactly minDistance from the query.
- Introduce a new shape operator, similar to $center and $centerSphere but with a minDistance argument in addition to maxDistance.
|