### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
Yes
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
----
#### AI description (iteration 1)
#### PR Classification
New feature implementation for the `$setWindowFields` stage.
#### PR Summary
This pull request implements the `$first(N)` and `$last(N)` aggregation functions for the `$setWindowFields` stage.
- Added new aggregate functions in `oss/pg_helio_api/sql/udfs/aggregation/group_aggregates--1.21-0.sql` for `BSONFIRST`, `BSONLAST`, `BSONFIRSTN`, `BSONLASTN`, and their sorted variants.
Related work items: #2151585, #2151587
This PR includes two parts:
1. The design doc of $fill
2. The implementation of $fill using `rewrite` way. Refer design doc [here](https://msdata.visualstudio.com/CosmosDB/_git/pgmongo/pullrequest/1423500?_a=files&path=/docs/pgmongo/design_docs/data_plane/aggregation_stages/fill.md).
3. Extract bson_expression_partition_by_fields_get() as a common method. So that, some related changes are:
a. densify's parse stage is changed
b. densify's unit tests is changed due to method name change
c. densify's original method for partitionByFields is removed
**Noticed:**
This implementation is based on the impl of `$linearFill` and `$locf`.
### Does this PR have any customer impact?
no
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
refactoring
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
yes
### Are you introducing any new config? If yes, do you have tests with and without them being set?
no
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
na
### Description
1. Move all legacy errors to new helio errors
2. Remove all refs to mongo_errors.h excluding error_utils.c , there is function which needs backword compatibility
3. Update `scripts/validate_helio_extension_state.sh` to enforce all validations on oss/pg_helio_api parent directory instead of individual sub directories
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup and deprecation.
#### PR Summary
This pull request moves all error handling to `helio_errors` and removes references to `mongo_errors.h`, deprecating certain functions.
- `error_utils.c`: Deprecated `command_throw_mongo_error` and `command_convert_mongo_error_to_postgres` functions.
- `mongo_errors.h`: Removed Mongo error handling code and redefined error code checks.
- `validate_helio_extension_state.sh`: Updated validation script to remove checks for `mongo_errors.h`.
- Added new SQL functions for database commands in `kill_op--1.22-0.sql`, `get_shard_key_value--1.22-0.sql`, and `reindex--1.22-0.sql`.
- Updated test files to reflect deprecation changes in error handling functions.
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
[OSS] Port more errors to oss (M of N)
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup and error handling improvement.
#### PR Summary
This pull request ports more error codes to the OSS (Open Source Software) version, replacing existing error codes with `ERRCODE_HELIO_*` equivalents and improving error detail logging.
- `bson_aggregation_output_pipeline.c`: Replaced various `Mongo*` error codes with `ERRCODE_HELIO_*` equivalents and updated error messages to use `errdetail_log`.
- `bson_aggregation_pipeline.c`: Updated error handling to use `ERRCODE_HELIO_*` equivalents and improved error detail logging.
- `bson_aggregation_nested_pipeline.c`: Replaced `Mongo*` error codes with `ERRCODE_HELIO_*` equivalents and enhanced error detail logging.
- `bson_project_operator.c`: Updated positional projection error handling to use `ERRCODE_HELIO_*` equivalents.
- `commands_update.out`: Updated expected error codes in test outputs to match new `ERRCODE_HELIO_*` values.
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
We cannot reuse the logic of firstN in the sort stag because the sort by key of the sort stage is a field, and the input and N of maxN are both expressions. maxN needs to sort the entire input expression.
for example :
input can be a expression:

N also can be a expression:

before the transition function, we need to evaluate input and n.
In the new implementation, we maintain a binaryHeap, the top of heap is maximum/minimum value.
For maxN:
**In transition funciton** :we need to maintain a small root heap and compare the current value with the top of the heap (minimum value). If the current value is greater than the top of the heap (minimum value), then we will pop the top of the heap and insert the current value.
**In the combine function,** each value of the left heap needs to be compared with the top of the right heap. If the conditions are met, the top of the right heap is popped out and the value is inserted. Each time, it is popped out from the left heap until the left heap is empty.
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc) Perf
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Migrate `$rand` and `$meta` to the new aggregation framework.
$rand does not need to exploit caching random constant values
----
#### AI description (iteration 1)
#### PR Classification
Performance improvement for miscellaneous aggregation operations.
#### PR Summary
This pull request optimizes and refactors various aggregation operations to enhance performance.
- Added and reordered function declarations in `include/operators/bson_expression_operators.h` for better organization.
- Implemented `ParseDollarRand` and `HandlePreParsedDollarRand` functions in `src/operators/bson_expression_miscellaneous_operators.c` to handle `$rand` expressions.
- Added `ParseDollarMeta` and `HandlePreParsedDollarMeta` functions in `src/operators/bson_expression_miscellaneous_operators.c` to handle `$meta` expressions.
- Updated `src/operators/bson_expression.c` to integrate new parsing and handling functions for `$rand` and `$meta` expressions.
Related work items: #3458675
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactor
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
NA
### Description
Port errors for geospatial, command, index_am folders
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request updates error codes and messages in the geospatial, command, and index_am folders to use the new `ERRCODE_HELIO` format.
- `src/geospatial/bson_geospatial_geonear.c`: Replaced `MongoTypeMismatch` and `MongoBadValue` with `ERRCODE_HELIO_TYPEMISMATCH` and `ERRCODE_HELIO_BADVALUE`.
- `src/commands/create_indexes.c`: Updated various error codes to `ERRCODE_HELIO_*` equivalents.
- `src/commands/find_and_modify.c`: Changed error codes to `ERRCODE_HELIO_FAILEDTOPARSE`.
- `src/commands/create_collection_view.c`: Replaced `MongoInvalidNamespace` and `MongoInvalidOptions` with `ERRCODE_HELIO_*` equivalents.
- `include/geospatial/bson_geospatial_private.h`: Updated include from `utils/mongo_errors.h` to `utils/helio_errors.h`.
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
UDF
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
add a window operator, $integral
----
#### AI description (iteration 1)
#### PR Classification
New feature: Adds a new window operator `$integral` for aggregation.
#### PR Summary
This pull request introduces the `$integral` window operator to compute integrals using the trapezoidal rule in BSON aggregation.
- Added `BsonIntegralAggState` structure and related functions in `bson_aggregates.c` to handle integral calculations.
- Implemented `HandleDollarIntegralWindowOperator` in `bson_aggregation_window_operators.c` to process the new `$integral` operator.
- Updated SQL UDFs in `group_aggregates_support--latest.sql` and `group_aggregates--latest.sql` to include the new `bson_integral_transition` and `bson_integral_final` functions.
- Added `BsonIntegralAggregateFunctionOid` in `metadata_cache.c` and `metadata_cache.h` for function OID retrieval.
- Exposed `GetDecimal128FromInt64` in `decimal128.c` and `decimal128.h` for converting integers to BSON decimal128 format.
Related work items: #3343290
### 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
### Are you introducing any new config? If yes, do you have tests with and without them being set?
Yes
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
$densify stage is implemented with all 3 modes
- range
- partition
- full
All 7 functional tests are passing, few tests which are explain specific will be pass in next PR with the changes

----
#### AI description (iteration 1)
#### PR Classification
New feature: Adds a new `$densify` aggregation stage.
#### PR Summary
Introduces the `$densify` aggregation stage to create new documents where certain field values are missing.
- Added detailed documentation for `$densify` in `docs/pgmongo/design_docs/data_plane/aggregation_stages/densify.md`.
- Implemented core aggregation logic in `oss/pg_helio_api/src/aggregation/bson_densify.c`.
- Created SQL functions and aggregates for densify operations in `oss/pg_helio_api/sql/udfs/aggregation/bson_densify_aggregates--1.21-0.sql` and `oss/pg_helio_api/sql/udfs/aggregation/bson_densify_aggregates--latest.sql`.
- Updated versioning and inclusion of new SQL files in `oss/pg_helio_api/sql/pg_helio_api--1.20-0--1.21-0.sql` and `pgmongo/sql/pgmongo--1.20-0--1.21-0.sql`.
Related work items: #3436236
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
Yes
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
$top, $topN, $bottom, $bottomN implementation for $group and $setWindowFields
----
#### AI description (iteration 1)
#### PR Classification
New feature: Added support for `$topN` and `$bottomN` group expression operators.
#### PR Summary
This pull request introduces the `$topN` and `$bottomN` group expression operators to the aggregation pipeline.
- `bson_aggregation_pipeline.c`: Added `ParseInputDocumentForTopAndBottom` function to parse input documents for `$topN` and `$bottomN` operators, and integrated it into the existing aggregation handling logic.
- `mongo_errors.h`: Defined new error codes for handling errors related to the new operators.
Related work items: #2151574, #2151576, #2151596, #2151597, #2988406, #2988407, #2988413, #2988415
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
----
#### AI description (iteration 1)
#### PR Classification
New feature: Added support for `$shift` operator in `$setWindowFields`.
#### PR Summary
This pull request introduces the `$shift` operator for window functions in BSON aggregation, along with additional rank-based window functions.
- Added `HandleDollarShiftWindowOperator` and related functions in `bson_aggregation_window_operators.c` to handle the `$shift` operator.
- Implemented `bson_rank`, `bson_dense_rank`, and `bson_shift` functions in `bson_aggregation_window_functions.c`.
- Added integration tests for rank-based window functions in `custom_rank.js`.
- Updated `bson_aggregation_pipeline_stage_setWindowFields.sql` with tests for `$rank` and `$denseRank` accumulators.
- Added OID lookup functions for new BSON window functions in `metadata_cache.c`.
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
https://www.mongodb.com/docs/manual/reference/operator/aggregation/toHashedIndexKey/
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
support for $out aggregation stage in aggregation pipeline
what we not support :
1. On Mult coordinator setup source and target can not be same
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request introduces the `$out` aggregation stage to the aggregation pipeline.
- `oss/pg_helio_api/src/aggregation/bson_aggregation_output_pipeline.c`: Added `HandleOut` function to handle the `$out` stage, including parsing, validation, and query mutation for outputting results to a specified collection.
Related work items: #1798580
### Does this PR have any customer impact?
Yes
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
1. Introduces a backend process level collator cache so that we open a collator for a specific collation string once per backend process
2. Uses collation-based sort key generation for string for supporting $in which uses Hashmap for membership check. We wanted the keys of the HashMap to be collation-aware for UTF8 keys.
----
#### AI description (iteration 1)
#### PR Classification
Code enhancement to improve collation handling in string comparison.
#### PR Summary
This pull request refines the string comparison logic using ICU collation in the `bson_compare.c` file.
- `bson_compare.c`: Replaced custom ICU collator creation with `ucol_open` and added error handling for unsupported collations. Closed the collator after use to prevent resource leaks.
- `bson_compare.c`: Added a reference to the ICU documentation for better clarity.
Related work items: #3412412, #3431062, #3456172
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactor
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Port more errors to helio for more folders.
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup to port error codes to Helio-specific error codes.
#### PR Summary
This pull request updates various error codes from Mongo-specific to Helio-specific error codes across multiple files.
- `vector_index_kind_impl.c`: Replaced `MongoBadValue` and `MongoFailedToParse` with `ERRCODE_HELIO_BADVALUE` and `ERRCODE_HELIO_FAILEDTOPARSE`.
- `shard_colocation.c`: Updated error codes from `MongoCommandNotSupported`, `MongoBadValue`, and `MongoFailedToParse` to Helio-specific equivalents.
- `bson_update_operators.c`: Changed error codes like `MongoTypeMismatch` and `MongoBadValue` to `ERRCODE_HELIO_TYPEMISMATCH` and `ERRCODE_HELIO_BADVALUE`.
- `parse_error.h`: Replaced `MongoTypeMismatch` with `ERRCODE_HELIO_TYPEMISMATCH`.
- `collection.c`: Updated error codes from `MongoBadValue` and `MongoInvalidNamespace` to Helio-specific equivalents.
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactor
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Move to helio error codes in pg-helio-core
Enforce hygiene in helio core
Move to helio errors
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request refactors error handling by replacing Mongo-specific error codes with Helio-specific error codes and updates error messages accordingly.
- Added `CheckNoMongoErrorCodes` function in `/scripts/validate_helio_extension_state.sh` to ensure no Mongo-specific error codes are used.
- Updated error codes and messages in `oss/pg_helio_core/src/query/bson_compare.c` to use Helio-specific codes.
- Modified error handling in `oss/pg_helio_core/src/types/pcre_regex.c` to replace Mongo error codes with Helio error codes.
- Replaced Mongo error codes with Helio error codes in `oss/pg_helio_core/src/io/pgbsonsequence.c`.
- Updated error codes in `oss/pg_helio_core/src/types/decimal128.c` to use Helio-specific codes.
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
This pr is forked from $rank and $denseRank pr.
----
#### AI description (iteration 1)
#### PR Classification
New feature: Adding support for `$documentNumber` in BSON aggregation.
#### PR Summary
This pull request introduces support for the `$documentNumber` window aggregation operator in BSON, along with `$rank` and `$denseRank` operators.
- `bson_aggregation_window_operators.c`: Added handlers for `$rank`, `$denseRank`, and `$documentNumber` window operators.
- `metadata_cache.c`: Added OID retrieval functions for the new BSON window functions.
- `bson_aggregation_window_functions.c`: Implemented the window functions for `$rank`, `$denseRank`, and `$documentNumber`.
- `window_aggregate_support--1.21-0.sql`: Created SQL functions for the new BSON window operators.
- `bson_aggregation_pipeline_stage_setWindowFields.sql`: Added test cases for the new window operators.
### Does this PR have any customer impact?
Yes
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
[schema validation] support validation in insertion
Details about evaluation part is here:https://msdata.visualstudio.com/DefaultCollection/CosmosDB/_git/pgmongo/pullRequest/1429339#1724674832
----
#### AI description (iteration 1)
#### PR Classification
New feature: Adds support for schema validation during document insertion.
#### PR Summary
This pull request introduces schema validation for document insertions, ensuring that documents adhere to specified schemas before being inserted into collections.
- `schema_validation.c`: Implements functions for preparing and validating documents against schema validators.
- `insert.c`: Integrates schema validation into the document insertion process.
- `bson_expr_eval.c`: Adds functions to evaluate expressions against documents for validation purposes.
- `schema_validation_insert.sql` and `schema_validation_insert.out`: Adds regression tests for schema validation during insertions.
- `SchemaValidationMetadataTests.cs`: Adds integration tests for schema validation during document insertion.
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Bugfix
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Fix typo in header guard macro definition that causes build warnings and multiple inclusions of the header file.
WKBBUfferITERATOR_H was replaced by WKBBufferITERATOR_H
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
This pull request fixes a typo in the header guard macro definition.
- `include/geospatial/bson_geospatial_wkb_iterator.h`: Corrected the macro definition from `WKBBUfferITERATOR_H` to `WKBBufferITERATOR_H`.
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
----
#### AI description (iteration 1)
#### PR Classification
New feature implementation.
#### PR Summary
This pull request introduces the `$expMovingAvg` aggregation operator to calculate the exponential moving average of numeric values.
- Added new aggregate functions in `oss/pg_helio_api/sql/udfs/aggregation/group_aggregates--1.19-0.sql` for BSON data types.
- Implemented supporting functions in `oss/pg_helio_api/sql/udfs/aggregation/group_aggregates_support--1.19-0.sql`.
- Documented the `$expMovingAvg` operator in `docs/pgmongo/design_docs/data_plane/aggregation_operators/expMovingAvg.md`.
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Adding feature counters
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request adds feature usage counters for user-related operations.
- `feature_counter.c`: Added new feature mappings for user CRUD operations.
- `feature_counter.h`: Defined new feature types for user CRUD operations and updated the maximum feature count.
- `users.c`: Integrated feature usage reporting for user create, drop, update, and get operations.
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
----
#### AI description (iteration 1)
#### PR Classification
Performance improvement for aggregation operations.
#### PR Summary
This pull request optimizes the handling of set aggregation operations by refactoring and adding new parsing and evaluation functions.
- `src/operators/bson_expression_set_operators.c`: Added and refactored functions for parsing and evaluating `$setEquals`, `$setDifference`, `$setIsSubset`, `$anyElementTrue`, `$allElementsTrue`, `$setUnion`, and `$setIntersection` expressions.
- Introduced helper functions for parsing and evaluating set operators with variable and dual operands.
Related work items: #3444465
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Migrate conditional operators (`$ifNull`, `$cond`, `$switch`) to new aggregation framework and ensure correct behavior.
----
#### AI description (iteration 1)
#### PR Classification
Performance improvement for conditional aggregation operations.
#### PR Summary
This pull request refactors and optimizes the handling of arithmetic and boolean aggregation operators to improve performance.
- `bson_expression_arithmetic_operators.c`: Refactored functions to handle pre-parsed arithmetic operations, added helper functions for single, dual, and variable operand parsing and evaluation.
- `bson_expression_boolean_operators.c`: Refactored functions to handle pre-parsed boolean operations, added helper functions for variable operand parsing and evaluation, and a unified boolean operator processing function.
Related work items: #3430332
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Adding support for $rank and $denseRank setWindowFields operator
----
#### AI description (iteration 1)
#### PR Classification
New feature: Implementation of `$rank` and `$denseRank` functions in pgmongo.
#### PR Summary
This pull request introduces the `$rank` window function to the pgmongo implementation, enabling rank-based aggregation operations.
- Added `BsonRankFunctionOid` and `HandleDollarRankWindowOperator` in `metadata_cache.c` and `bson_aggregation_window_operators.c` respectively.
- Implemented `bson_rank` function and `RankContext` struct in `bson_aggregates.c`.
- Updated SQL scripts `window_aggregate_support--1.20-0.sql` and `window_aggregate_support--latest.sql` to include the new `bson_rank` function.
- Declared `BsonRankFunctionOid` in `metadata_cache.h`.
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Test
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Making more compat tests pass
### Does this PR have any customer impact?
Yes
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
Add aggregation operator: $sampleRate
### Description
Implementation for $sampleRate operator
### 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)
UDF
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Implemented covariancePop & covarianceSamp for setWindowFields
----
#### AI description (iteration 1)
#### PR Classification
Documentation
#### PR Summary
This pull request adds design documentation for the `$covariancePop` and `$covarianceSamp` aggregation operators.
- Added `covariancePop.md` detailing the specification, behavior, examples, implementation plan, and test plan for the `$covariancePop` operator.
- Added `covarianceSamp.md` detailing the specification, behavior, examples, implementation plan, and test plan for the `$covarianceSamp` operator.
### Does this PR have any customer impact?
Yes
### 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?
Yes (helio_api.enableCollation). Yes.
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
Done
### Description
Runtime implementation of collation support in Mongo Find query.
We parse the Mongo collation spec and covert it to an ICU standard collation string. An example string is "und-u-ks-level1-kc-true This string uniquely identify collation-based string comparison logic by Postgres. See: https://www.postgresql.org/docs/current/collation.html
This document tracks the current support matrix for query operators
| Operator | Runtime | Index Pushdown | Comments
| --------- | ---- | ----- | ----
| $eq | Yes | No |
| $gt | Yes | No |
| $gte | Yes | No |
| $lt | Yes | No |
| $lte | Yes | No |
| $ne | Yes | No |
| $in | No* | No | See below
| $nin | No* | No | Do
| $and | Yes | No |
| $not | Yes | No |
| $nor | Yes | No |
| $or | Yes | No |
| $all | Yes | No |
| $elemMatch | Yes | No |
| $positional | N/A | N/A | positional query operators are only used in projections.
| $regex | N/A | N/A | $regex ignores collations in Native Mongo
| $exists | N/A | N/A |
| $size | N/A | N/A |
| $type | N/A | N/A |
| $bitsAllClear | N/A | N/A | Not relevant for Utf8
| $bitsAnyClear | N/A | N/A | Do
| $bitsAllSet | N/A | N/A | Do
| $bitsAnySet | N/A | N/A | Do
| $mod | N/A | N/A | Do
| $range | N/A | N/A | Only applies to Number
| $text | N/A | N/A | Seprate Index, has its own collation spec
| $geowithin | N/A | N/A | Not relevant for Utf8
| $geointersects | N/A | N/A | Do
* $in/$nin is implemented with HashMap that does not support collation friendly Hashkeys
* $regex : collations are ignored with
* $text: $text spec has collation specific parameters
* $rage: For numbers only
This document tracks the current support matrix for update operators/commands
| Operator | Runtime | Index Pushdown |
| --------- | ---- | ----- |
| find_and_modify | No | No |
| updateOne | No | No |
| updateMany | No | No |
| createIndex | No | No |
Tests:
1. All Gated Tests pass when Collation is enabled by default
TODO:
1. Index support [already implemented - but breaking down for easy review]
2. Persist collation info while collection created [already implemented - but breaking down for easy review]
3. $cond, $let
Related work items: #3412359
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactor
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
Yes
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Prep for porting backend distributed tests
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup and preparation for porting backend distributed tests.
#### PR Summary
This pull request removes obsolete code and prepares the codebase for porting backend distributed tests.
- Deleted `cluster_operations.c` and `version_utils.c` from `pgmongo/src`.
- Added new functions and triggers in `helio_distributed_test_helpers.sql` and `helio_distributed_test_helpers.out` for testing.
- Updated `cluster_operations.c` in `pg_helio_distributed` to include new cluster management functions.
- Added new SQL files for cluster operations and version utilities in `pg_helio_distributed`.
- Modified `pgmongo.c` to set up global variables for distributed functions and index build queue table creation.
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Implement the arithmetic and boolean operators after the new aggregation framework pattern.
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
[let] Enable let by default on top level find, aggregate and lookup
This adds the missing validation and parsing of let spec to be able to enable it by default, and also changes the let GUCs to be true by default.
----
#### AI description (iteration 1)
#### PR Classification
New feature: Enable `let` by default on top-level `find`, `aggregate`, and `lookup` commands.
#### PR Summary
This pull request enables `let` by default for top-level `find`, `aggregate`, and `lookup` commands, and adds validation to disallow certain expressions in top-level `let` specifications.
- `bson_aggregation_pipeline.c`: Added functions to parse and validate top-level `let` expressions, disallowing path expressions, `CURRENT`, and `ROOT`.
- `bson_aggregation_nested_pipeline.c`: Updated validation for `let` expressions in nested pipelines to ensure no variables are used to define other variables.
- `bson_aggregation_pipeline_tests_let.out` and `bson_aggregation_pipeline_tests_let.sql`: Added tests for new `let` functionality and validation rules.
- `helio_api_init.c`: Enabled `let` and `lookup let` support by default.
Related work items: #1806751
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
TSG
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
This change introduces a section in the SOP that includes a script enabling simultaneous updates across multiple accounts under the same subscription.
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Write directly to shard if available
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup and optimization.
#### PR Summary
This pull request refactors the shard handling logic to directly write to a shard if available, removing redundant code and simplifying the shard query process.
- `src/api_hook_impl.c`: Simplified shard query logic by removing the `GetShardIdOptimistically` function and optimizing the shard ID retrieval process.
- `src/metadata/collection.c`: Removed the `allowLocalShard` parameter and related logic, streamlining the collection retrieval process.
- `src/aggregation/bson_aggregation_output_pipeline.c` and `src/aggregation/bson_aggregation_pipeline.c`: Updated functions to use the simplified collection retrieval method.
- `include/metadata/collection.h`: Removed the declaration for `GetMongoCollectionOrViewByNameDatumWithLocalShard`.
- `src/helio_api_init.c`: Changed the default value of `UseLocalExecutionShardQueries` to `true`.
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
https://www.mongodb.com/docs/manual/reference/operator/aggregation/unsetField/
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Refactoring
### 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?
Yes
pgmongo.enableVectorDiskANNIndex: default is off
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Refactoring vector search to support different index types in oss helio and pgmongo
### 1. Index type
- helio: vector-ivf, vector-hnsw
- pgmongo: vector-ivf, vector-hnsw, vector-diskann
### 2. Vector index creation
- ParseIndexCreationSpecFunc
- ValidateIndexCreationSpecFunc
- GenerateIndexCreationCmdFunc
### 3. Vector search
- ParseIndexSearchSpecFunc
- ValidateIndexSearchSpecFunc
### 4. Planner and custom scan
- GetIndexAccessMethodOidFunc
- GetSimilarityOpOidByFamilyOidFunc
- SetSearchParametersToGUCFunc
- GetDefaultSearchParamBsonFunc
- CalculateSearchParamBsonFunc
### 5. Test cases
- bson_aggregation_pipeline_tests_vector_diskann
- bson_aggregation_pipeline_tests_vector_hnsw
- bson_aggregation_pipeline_tests_vector_ivf
- bson_aggregation_pipeline_tests_vector_mongo
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Dleete unsharded
----
#### AI description (iteration 1)
#### PR Classification
Performance improvement
#### PR Summary
This pull request enhances the performance of unsharded delete operations by introducing new serialization and deserialization methods and optimizing batch deletion processing.
- `src/commands/delete.c`: Added `SerializeUnshardedDeletionSpec` and `DeserializeDeleteWorkerSpecForUnsharded` functions to handle unsharded deletions.
- `src/commands/delete.c`: Modified `command_delete_worker` to support unsharded delete operations and improved batch deletion handling.
- `src/helio_api_init.c`: Introduced a new configuration flag `EnableUnshardedBatchDelete`.
- `src/commands/find_and_modify.c`: Updated `CallDeleteOne` to include a `forceInlineWrites` parameter.
- `include/commands/delete.h`: Updated function signature for `CallDeleteOne` to include `forceInlineWrites`.
### Does this PR have any customer impact?
Bugfixes for Background indexes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Bugfixes
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
1) On index failure due to unique index violation, return DuplicateKey with the same error as insert
2) If an index build is in progress and a concurrent build is requested, wait on the concurrent build (rather than returning "build with the same options exist" - this means that if the first index build fails both calls fail and the second call doesn't assume the index exists
3) Don't query index builds during write commands (only query valid indexes for `$merge`, `$indexStats` etc
4) When an index build fails, don't immediately remove it from the index queue. Instead mark it as skippable. Once all the index builds complete after 20 mins, the index will be removed from the queue. This solves the issue of "index build failed but index was not found in main table"
5) Push unique index build to the background - running it in the foreground did not produce a better experience from private preview feedback
6) If the index build fails with a Mongo error, immediately mark it as skippable (not as failed)
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
This pull request addresses issues with creating indexes in the background by improving error handling and index conflict detection.
- `commands_common.c`: Added `TryGetErrorMessageAndCode` function to improve error message retrieval and handling.
- `create_indexes.c`: Enhanced conflict detection for index specifications and added handling for indexes in progress.
- `create_indexes_background.c`: Improved error handling and logging for background index creation.
- `index.c`: Updated SQL queries to include index build progress status.
- `cluster_operations.c`: Adjusted setup logic to handle index build tasks more effectively.
Flows a parse aggregation expression context while parsing the expression so that we can track if there were variables, operators, path expressions and do top level validation if needed for things like $let, etc.
----
#### AI description (iteration 1)
#### PR Classification
API change to add a parse aggregation expression context while parsing aggregation expressions.
#### PR Summary
This pull request introduces a `ParseAggregationExpressionContext` to track the types of expressions encountered during the parsing of aggregation expressions.
- `include/operators/bson_expression_operators.h`: Added `ParseAggregationExpressionContext` parameter to various `ParseDollar*` functions.
- `src/operators/bson_expression_bitwise_operators.c`: Updated bitwise operator parsing functions to include the new context parameter.
- `src/operators/bson_expression_date_operators.c`: Modified date operator parsing functions to use the new context parameter.
- `src/operators/bson_expression_string_operators.c`: Updated string operator parsing functions to include the context parameter.
- `include/operators/bson_expression.h`: Defined the `ParseAggregationExpressionContext` struct.
### 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
### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
----
#### AI description (iteration 1)
#### PR Classification
New feature: Adds support for index pushdown in join conditions for the `$merge` stage in aggregation pipelines.
#### PR Summary
This pull request introduces index pushdown capabilities for join conditions in the `$merge` stage, enhancing query performance.
- `src/opclass/index_support.c`: Added support functions for index pushdown in `$merge` join filters.
- `sql/udfs/aggregation/bson_merge_functions--1.20-0.sql`: Created new SQL functions to support index pushdown and handle merge operations.
- `src/aggregation/bson_aggregation_output_pipeline.c`: Implemented functions to create join expressions and extract merge filters.
- `Tests.Postgres.CSharp/Integration/Aggregation/MergeTests.cs`: Added integration tests to verify index pushdown functionality.
- `src/metadata/metadata_cache.c`: Added function OIDs for new merge-related functions.
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Implementation of $stdDevPop and $stdDevSamp accumulators.
Reference:
[stdDevPop](https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevPop/)
[stdDevSamp](https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevSamp/)
Related work items: #3277074
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Bugfix
### 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?
Yes
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
- Implement READ for some scan types to avoid internal errors
- Move feature flag for local shard use to the local shard use feature flag.
----
#### AI description (iteration 1)
#### PR Classification
Bug fix and feature flag correction.
#### PR Summary
This pull request addresses an internal error and corrects the usage of a feature flag.
- `custom_scan_continuation.c`: Added functions for reading and writing custom scan nodes, replacing unsupported functions.
- `rum_custom_join_scan.c`: Added functions for reading and writing custom join scan nodes, replacing unsupported functions.
- `api_hook_impl.c`: Corrected feature flag usage from `EnableNativeColocation` to `UseLocalExecutionShardQueries`.
- `custom_query_scan.c`: Updated error messages for unsupported node types to be more specific.
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Multinode improvements: Better diagnostics on sharding:
- This shows each data bearing node as a "shard_##"
- It shows each sharded table and what nodes the shards are on.
- Shows the rebalancer as off and auto-split as off

Introduces the chunks table where we can report chunks and sizes:

- This will also report sizes of each chunks so you can run aggregate queries to get size per node, size per table etc.
----
#### AI description (iteration 1)
#### PR Classification
Enhancement for multinode and multi-region support.
#### PR Summary
This pull request introduces significant improvements to the multinode and multi-region capabilities of the system by adding new query rewriting functions and enhancing existing ones.
- `shard_colocation.c`: Added `RewriteConfigShardsQueryForDistribution` to handle shard configuration queries and `RewriteConfigChunksQueryForDistribution` to manage chunk configuration queries, including integration with Citus for shard size information.
### Does this PR have any customer impact? Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Implemented support for $degreesToRadians, $radiansToDegrees, $sin, $cos, $tan, $sinh, $cosh, $tanh, $asin, $acos, $atan, $atan2, $asinh, and $atanh trig operators
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request adds support for trigonometric operators in BSON expressions.
- Added trigonometric functions (`$sin`, `$cos`, `$tan`, `$sinh`, `$cosh`, `$tanh`, `$asin`, `$acos`, `$atan`, `$atan2`, `$asinh`, `$acosh`, `$atanh`) in `oss/pg_helio_api/src/operators/bson_expression_trigonometry_operators.c`.
- Added extensive test cases for the new trigonometric operators in `/pgmongo/src/test/regress/expected/bson_aggregation_trigonometric_operators_tests.out`.
### Does this PR have any customer impact?
Yes, it provides support for $changeStream pipeline stage for creating change stream cursor and consuming events from it.
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature.
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
Adds a new UDF for change_stream_aggregation
### Are you introducing any new config? If yes, do you have tests with and without them being set?
Adds a GUC for enabling ChangeStreams freature and tests have been added to test the feature. It is disabled by default.
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
../docs/pgmongo/design_docs/data_plane/change_streams/change_stream_release_notes.md
### Description
This PR implements the change stream tailing cursors using the direct WAL decoding. It avoids using replications slots for logical decoding because of the constraints in creating and decoding with replication slots.
Related work items: #2973720
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Perf
### 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?
Yes (Feature flag for scan perf)
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Enables joining across multiple RUM indexes for bitmap scans (so that the user doesn't need to create a single composite index for performance).
----
#### AI description (iteration 1)
#### PR Classification
Performance improvement
#### PR Summary
This pull request introduces optimized cross RUM index joins to enhance query performance.
- Added `rum_custom_join_scan.c` to implement custom scan logic for RUM index joins.
- Updated `rumget.c` to include `multiandgetbitmap` function for handling multiple index scans.
- Modified `custom_scan_continuation.c` to integrate custom scan paths and optimize query plans.
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
Yes
### Are you introducing any new config? If yes, do you have tests with and without them being set?
Yes and Yes
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
- Fix up bugs with $lookup with Let by rewriting lookup to be let friendly
- Get through jstests having lookup with let
- Optimize Lookup where hte left and right both are on _id to support joins directly on object_id
- Allow the lookup pipeline to be split as "inlined" and "non-inlined" and allow pushing up the inlined pipeline
- Fix bugs with facet/graphlookup arising from Lookup with let tests
- Allow inlining the $unwind path after a $lookup if the $unwind matches a $lookup as (behind a feature flag)
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
MongoDB doc:
https://www.mongodb.com/docs/manual/reference/operator/aggregation/getField/
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Bugfix
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
For release we might need to discuss as there can be clients which are using this option.
### Description
This aims to fix the jstest "jstests/core/find_with_ntoreturn_fails.js"
This test states the option ntoreturn is not supported since mongo version>=5.1
hence, removing support
Related work items: #3336041