mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-07 03:22:46 -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) No ### Are you introducing any new config? If yes, do you have tests with and without them being set? No ### ChangeLog (Refer [Template](../oss/CHANGELOG.md)) - Support top level let variables in $geoNear stage ### Description Support top level let variables in $geoNear stage - Today there are 2 scenarios where `let` is used with $geoNear 1- `top level`: Any `let` provided in the top level command such as `aggregate`, the variables used in geonear spec should result into a `constant`, so we evaluate and rewrite the geoNear spec before parsing it to replace any expressions/let variables from top level let. 2- `nested let`: This scenario occurs with lookup pipeline and let is a combination of top level let and lookup let, this case is not optimized in this PR and will still return in error ---- #### AI description (iteration 1) #### PR Classification New feature #### PR Summary This pull request adds support for top-level `let` expressions within the `$geoNear` stage in aggregation pipelines. - `oss/pg_documentdb/src/aggregation/bson_aggregation_pipeline.c`: Added logic to handle `let` expressions by updating the `$geoNear` specification if a `CONST let` expression is present in the context. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->