### 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: Add DiskANN index support to pgmongo for vector search.
#### PR Summary
This pull request introduces DiskANN index support to the pgmongo backend, enabling efficient vector search capabilities.
- Added extensive SQL tests for DiskANN index creation, parameter validation, and search operations in `bson_aggregation_pipeline_tests_vector_diskann.sql`.
- Implemented new test cases in `SearchTests.cs` to validate DiskANN index functionality, including index creation, search operations, and error handling.
- Updated expected output in `bson_aggregation_pipeline_tests_vector_prefilter.out` to reflect new DiskANN index tests and results.
### 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)
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
remove legacy errors completely
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request removes legacy MongoDB error handling code and all related references.
- Deleted `mongo_errors.h`.
- Removed `CheckNoMongoErrorCodeHeader` function and related calls from `scripts/validate_helio_extension_state.sh`.
- Updated `error_utils.c` to remove legacy MongoDB error handling logic.
- Deleted deprecated functions from `helio_distributed_test_helpers.sql` and `pgmongo_test_helpers.sql`.
- Updated expected test outputs in `helio_distributed_test_helpers.out` and `pgmongo_test_helpers.out` to reflect the removal of deprecated functions.
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?
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
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?
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
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?
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?
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)
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, 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)
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))
- Support for `$setWindowFields` aggregation pipeline stage
### Description
This PR adds the support for `$setWindowFields` aggregation stage using the Postgres `Window aggregation` operators.
For the first PR it only adds support with `$sum` aggregation operator.
Next set of PRs will individually support all the other window aggregation operators supported by `$setWindowFields` stage.
[TODO] Currently $sum is used as is (the way $group uses it), there is way to optimize this using the `Inverse Transition` functions for Window aggregation which modifies the aggregated state in a way to accomodate rows leaving the group in a moving window, which will be done later (this is done to make review on smaller set of files)
Related work items: #2272584
### 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
Add bucket aggregation stage
Query time comparison for $bucket between Atlas and vCore:
https://microsoftapc-my.sharepoint.com/❌/g/personal/shuaitian_microsoft_com/EduvH4BY2O9Dnt92siIPJlUBOF5DNKNeF4BSQ6NeyZO-iQ?e=xGAuIC
Related work items: #1798584
### 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
- Delete dead configs
- Reduce number of calls to check version information
- Move ExtensionVersion checks to shared memory
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
No
### 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:
**Things this PR has:**
1. support for $merge stage for unsharded collection.
- whenNotMatched : support for `fail` , `discard` and `insert` option.
- whenMatched : support for `replace`, `fail` and `keep-existing` option.
**What next In upcoming PR's :**
1. support for 'merge' option whenMathced
2. support for 'pipeline' option whenMatched.
3. support for sharded collection.
4. support of co-located collection. (one case : when source and taget is same)
5. Index push down for join condition.
6. optimizations in case of sharded collection and unsharded collection for single aggregation stage when we can directly refer source shard_key_column.
Related work items: #3085830
### 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
wave1 - create/update/get for schema validation metadata
### 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
Related work items: #3116418, #3244312
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
support for $vectorSearch in aggregation pipeline.
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Perf/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
For unsharded collections we create 32 connections per table for create indexes and only 1 of them does any work: Use sequential access to better utilize connections.
### 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
$sortArray (aggregation) operator
Related work items: #2019138
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
No
### Description
Add support for $maxN/ $minN aggregation array operator.
Related work items: #2019119, #2019127
### 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)
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
1. Reduce default value of cron job schedule to 2 seconds for Index Build background feature.
Though, the Index Build background feature is behind GUC (disabled by-default)
2. Disable cron job for upgrade test, we have seen flakiness in the test
3. DropIndexes should be able to cancel CreateIndexes as right owner so that execution of DROP INDEX CONCURRENTLY is cleaner and it does not conflict with CREATE INDEX CONCURRENTLY
Sample serverside logs for 3rd point
```
2024-04-16 16:54:34.990 UTC [40693] LOG: Cancel existing index build request for 6 is completed.
2024-04-16 16:54:34.990 UTC [40693] STATEMENT: CALL mongo_api_v1.drop_indexes_concurrently($1, $2)
**2024-04-16 16:54:34.991 UTC [40704] WARNING: CONCURRENTLY-enabled index commands can fail partially, leaving behind an INVALID index.
Use DROP INDEX CONCURRENTLY IF EXISTS to remove the invalid index.
2024-04-16 16:54:34.991 UTC [40704] ERROR: canceling statement due to user request
2024-04-16 16:54:34.991 UTC [40704] HINT: canceling statement due to user request
2024-04-16 16:54:34.991 UTC [40704] STATEMENT: CREATE INDEX CONCURRENTLY documents_rum_index_6 ON mongo_data.documents_1 USING pgmongo_rum ( document mongo_catalog.bson_rum_single_path_ops(path='_id'), document mongo_catalog.bson_rum_single_path_ops(path='vendorItemId'))
2024-04-16 16:54:34.991 UTC [40705] ERROR: canceling statement due to user request
2024-04-16 16:54:34.991 UTC [40705] HINT: canceling statement due to user request**
2024-04-16 16:54:34.991 UTC [40705] STATEMENT: CREATE INDEX CONCURRENTLY documents_rum_index_6_102045 ON mongo_data.documents_1_102045 USING pgmongo_rum (document mongo_catalog.bson_rum_single_path_ops (path = '_id' ) ,document mongo_catalog.bson_rum_single_path_ops (path = 'vendorItemId' ) )
Related work items: #3109561
### 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)
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Related work items: #2019195
### 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))
Support $geoNear aggregation stage
### Description
Add the design doc and necessary operators and functions needed for $geoNear
Also,
1- Implement the $geoNear aggregation stage skeleton and support all options.
- `distanceField`,
- `near` (both legacy, geojson point)
-`includeLocs`,
-`minDistance` & `maxDistance`
- `distanceMultiplier`
- `key`
2- Support index pushdown of the stage to `2d` and `2dspher` index.
- spherical / non-spherical distance support for `2d` index.
- spherical distance support for `2dsphere` index
Things still a TODO.
1- ~~Update the mongo explain plans for geonear stage~~.
2- Make the stage require an index always, currently it can be executed without index too.
3- Fix projection for nested array fields.
4- Make common test setup for running $geoNear queries in JSTests which don't require key in mongo.
5- More testing and validations with other stages that can use $geoNear.
6- Test batching and cursor support.
7- Overall testing and validations
Related work items: #3000189, #3065270
### 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))
### Description
Prep to do schema hotfix for colocation. Port to 1.13 / 1.14
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
adding support for $dateTrunc mongo operator
Related work items: #2019212
### 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)
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Add inverseMatch aggregation stage
Currently it supports a spec like:
```
{ path: <path>, input: <doc or array of docs/path expression>, defaultResult: [optional | <bool> ]}
```
So if we want to fetch the input to the document query from an external collection, a lookup stage would need to be added prior to the inverseMatch.
The next stage of this feature is to support a spec like:
```
{ path: <path>, fromCollection: <coll>, pipelines: [$match/$project/$limit], defaultResult: [optional | <bool> ]}
```
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
N/A
### Description
- Add support for colocating tables in Postgres using the citus colocation mechanisms.
- Add support for modifying colocation with collMod
- Add support for querying shardCount and colocationId of tables in Mongo
Do this in a way that extends Helio using hooks.
### 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)
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
From the remaining TODOs handles the following:
- [Done] To handle arrays we do a `$unwind` - move that to doing an eq/in based on the input: This is done by adding a makeArray aggregation operator and using that with `$in` expression
- [Done] Think about cycles: Add a visited check and ignore nodes that are visited before.
- [Done] Need to handle maxDepth infinite recursion more gracefully with $graphLookup.
- [Done] Need to validate against jstests
Still TODO:
- More testing on dotted paths and arrays & reducing traversals
- Implement a hash aggregate operator class for BSON
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
N/A
### Description
Implement the basic skeleton for $graphLookup under a feature flag.
Remaining TODOs:
1) To handle arrays we do a $unwind - move that to doing an $eq/$in based on the input
2) Implement a hash aggregate operator class for BSON so we can use a UNION query instead of UNION ALL
3) Need to validate against jstests
4) Need to handle maxDepth infinite recursion more gracefully with $graphLookup.
5) More testing on dotted paths and arrays
6) Think about cycles
Related work items: #1798581
### 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))
### Description
Issue:
Since the owner of scheduled cron job for index build background is admin user i.e. 'postgres' in prod, the CREATE INDEX CONCURRETLY queries are owned by 'postgres' user in pg_stat_activity.
And non-admin user who requests for currentOp to get progress of running indexes, does not have enough privilege to read queries owned by admin user in pg_stat_activity.
Solutions:
From inside running cron-job, create LibPQ connection as the non-admin user for CREATE INDEX CONCURRENTLY. The pre-requisite for this approach is that we have the information of user-oid who has submitted the request in queue. I.e. This needs user_name column in index_queue table.
Related work items: #2961369
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Changes:
- Unify rum_tuplesort_get_estimated_itemcount between PG16/PG15
- Remove set local force_parallel_mode TO ON; - This flag is removed in PG16
- Remove legacy query generation for lookup tests
- Citus 12.1 made the default behavior not to push down filters - set htat GUC to true for the extension
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Devops
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No(ish)
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Add function to emit data plane metrics from teh extension. Add a cron job to publish that every min.
Register that function as a cron job in flex.
This first part publishes the FeatureCounter data into warm path config as so:

Subsequent changes will be made to add more metrics into the emission path.
### 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)
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Add more checks for OSS references