mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-08 11:55:30 -05:00
### Does this PR have any customer impact? No ### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) Feature ### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes) Yes ### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md)) Added support for $geoNear aggregation stage pipeline. ### Description Part 2 for supporting geoNear stage This fixes following TODOs from the last PR: 1. Push `$minDistance` and `$maxDistance` to index similar to mongo. ✅ ================= Created a new range distance query operator `@|><|` which is supported by both `2d` and `2dsphere` indexes. $geoNear now uses this instead of float8 distance less than / greater than comparisions. 1. [TODO] Make the stage require an index always. ❌ ================= $geoNear queries always require a geo index in mongo 1. Fix projection for nested array fields. ✅ ================= $geoNear projection for `distanceField` or `includeLocs` overrides the intermediate array nodes instead of recursing into arrays and updating each element. 1. Make common test setup for running $geoNear queries in JSTests which don't require key in mongo. ✅ ================= Mongo JSTests mostly create single geo index on the collection and misses the `key` option for $geoNear stage, so we override couple of mongo functions to make sure if we are using the $geoNear stage then we can update the pipeline to contain the respective `key` field, so that tests can run without failure. 1. More testing and validations with other stages that can use $geoNear. ✅ 1. Test batching and cursor support. ✅ 1. Overall testing and validations ✅ 1. $geoNear Tests passed: **Out of 23 test dependent on $geonear now 9 are passing**, and rest are again dependednt on $near and $nearSphere which is a subset of $geonear Related work items: #2782870, #2782872