### 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
Split up GUCs by intent:
- Testing GUCs - only for backend or test infra
- System GUCs - configuration of the system as a whole
- Background GUCs - configuration for background jobs
- Feature flag GUCs - GUCs that are transient and we should track enabling and removing them
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request refactors the codebase by splitting up GUC (Grand Unified Configuration) files based on their intent, improving modularity and maintainability.
- Refactored `documentdb_init.c` to delegate GUC initialization to specific functions.
- Added new files `feature_flag_configs.c`, `system_configs.c`, `background_job_configs.c`, and `testing_configs.c` for modular GUC initialization.
- Updated `config_initialization.h` to declare new initialization functions.
- Adjusted related configurations in `documentdb_distributed_init.c` and test files to align with the new structure.
### 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
the PR to fix some cases of jstests/core/server6238.js, 
15 line of case cannot be fixed yet, because `$a` is not a operator, in group stage should report `InvalidPipelineOperator`, in project stage, should report error code `31325` . so to fix the case, we need to distinguish the group stage and the project stage in ParseAggregationExpressionData Function.
fix some cases of jstest.
when field is start with "$", ErrorCode should is 16410.
example:
```
db.coll1.aggregate([
{
$project: {
$a: "$a"
}
}
]);
```
when field is invalidOperator, ErrorCode should is 40236
```
db.jstest1.aggregate([
{
$group: {
_id: "$_id",
$a: {
$sum: 1
}
}
}
]);
```
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
This pull request addresses a bug in the jstest_server by adding a new error code and updating related error handling logic.
- `helio_conversion_codes.c`: Added handling for `ERRCODE_HELIO_LOCATION40236`.
- `bson_tree.c` and `bson_io.c`: Updated error codes to use `ERRCODE_HELIO_LOCATION40236`.
- `helio_errors.h`, `helio_codes.txt`, `helioerrors.csv`, `mongoerrors.csv`, and `mongo_codes.csv`: Added definitions and entries for `ERRCODE_HELIO_LOCATION40236`.
### 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
the PR to fix js error of date_from_string_on_error.js
fix case, when onError is provided and dateSring is invalid ,need to throw onError.
example:
dateString is 5, should throw onError.
`db.date_from_string_on_error.aggregate([
{
$project: {
date: {
$dateFromString: {
dateString: 5,
format:null,
onError: ISODate("2017-07-04T11:56:02Z")
}
}
}
}]);`
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
This pull request addresses a corner case in the `date_from_string_on_error.js` test by improving error handling in date parsing functions.
- `src/operators/bson_expression_date_operators.c`: Added checks for `isOnErrorProvided` to handle cases where `onError` is specified, ensuring proper error handling and result setting.
- Modified several functions to include the `isOnErrorProvided` parameter to improve error handling logic.
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
1) Reduce CPU due to GUID generation per request - Assign a unique connectionID and cycle requests through for that connection
2) Reduce Size of the response object - move "ShouldSendResponse" to the request as a computed property
3) Reduce async/await callstacks in the Transport flow
4) Prepare queries on system connection (to avoid random parsers in background requests)
5) Move cursorId and Persisted connection to the beginning of the continuation response (for future perf change)
6) For point read request plan, only allocate lists of the correct size.
----
#### AI description (iteration 1)
#### PR Classification
Performance improvement.
#### PR Summary
This pull request includes performance-related changes to the BSON aggregation cursor tests.
- Modified `bson_aggregation_cursor_tests.out` to update the structure and content of the test output for aggregation and find queries.
### 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 source files not pertinent to OSS out of OSS
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request moves source files not pertinent to OSS out of the OSS directory and includes some code refactoring.
- Moved `rum_custom_join_scan.c` and `external_configs.c` from `pg_documentdb` to `pg_helio_api`.
- Added `IsValidScanPath` function and refactored path validation in `custom_scan_continuation.c`.
- Introduced `TryOptimizePathForBitmapAnd` function in `api_hooks.c` and updated related hooks.
- Added new external configuration variables in `documentdb_init.c`.
- Removed `RegisterRumJoinScanNodes` from `pg_documentdb` and added it to `pgmongo` and `pg_helio_api`.
### 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?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Move DocumentDB to schema version 0. To do this version checks now need to handle internal and external versions being different.
Tackle this in version_utils.c
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request adds support for DocumentDB on version 0.
- Modified `cluster_operations.c` to use `DocDB_V0` for version checks.
- Updated `version_utils.h` and `version_utils.c` to define and use `MajorVersion` enum for version handling.
- Adjusted various files in the `aggregation` directory to use `DocDB_V0` for version checks.
- Updated `create_indexes.c` to use `DocDB_V0` for version checks.
### 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))
### Description
Start porting schemas for documentdb api.
Introducing API_SCHEMA_NAME_V2, API_SCHEMA_INTERNAL_NAME_V2, API_CATALOG_SCHEMA_NAME_V2
----
#### AI description (iteration 1)
#### PR Classification
Porting type/operator/schema into documentdb.
#### PR Summary
This pull request ports various types, operators, and schemas into documentdb as part of an ongoing effort.
- `pg_documentdb/sql/documentdb--0.24-0.sql`: Created multiple schemas and included various SQL files for query functions, operators, and metadata.
- `pg_documentdb/sql/operators/bson_dollar_operators--0.16-0.sql`: Updated operator definitions to use `__API_SCHEMA_INTERNAL_V2__`.
- `pgmongo/sql/operators/bson_dollar_negation_operators--1.15-1.sql` and `pg_documentdb/sql/operators/bson_dollar_negation_operators--0.16-0.sql`: Changed operator definitions to use `__API_SCHEMA_INTERNAL_V2__`.
- `Makefile.cflags`: Added checks for new schema variables `API_SCHEMA_NAME_V2`, `API_SCHEMA_INTERNAL_NAME_V2`, and `API_CATALOG_SCHEMA_NAME_V2`.
- `pg_documentdb/sql/schema/unique_shard_path_operator_class--0.24-0.sql`: Updated operator class definitions to use `__API_SCHEMA_INTERNAL_V2__`.
### 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 UDF mongo_api_internal.authenticate_with_pwd(p_usename text, p_password text)
output: Boolean
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request introduces support for user authentication using a password in the Data API.
- Added `command_authenticate_with_pwd` function in `src/auth/scram256.c` to handle password-based authentication.
- Created new SQL function `helio_api.authenticate_with_pwd` in `sql/udfs/auth/auth_scram--1.24-0.sql`.
- Updated test cases in `src/test/regress/sql/authentication_scram_sha_256.sql` and `src/test/regress/expected/authentication_scram_sha_256.out` to use the new `authenticate_with_pwd` function.
- Removed the old `test_helio_scram_sha256_dual_api` function from test files.
Related work items: #3316477, #3685426
### 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))
### Description
Move udf files from pg_helio_api -> pg_documentdb
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request moves User Defined Function (UDF) files from the `pg_helio_api` directory to the `pg_documentdb` directory.
- Updated `pgmongo/sql/pgmongo--1.23-0--1.24-0.sql` to include UDFs from `pg_documentdb` instead of `pg_helio_api`.
- Modified `oss/pg_helio_api/sql/pg_helio_api--1.15-0--1.16-0.sql` to reference UDFs from `pg_documentdb`.
- Adjusted `oss/pg_helio_api/sql/pg_helio_api--1.10-0.sql` to include UDFs from `pg_documentdb`.
- Updated `scripts/validate_helio_extension_state.sh` to add validation exceptions for the moved UDF files.
- Changed `pgmongo/sql/pgmongo--1.21-0--1.22-0.sql` to reference UDFs from `pg_documentdb`.
### 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 is the PR to fix js error of jstests/core/server1470.js
In upsert case, TraverseQueryDocumentAndProcess skips processing $ref or $id, for example, given sample query:
`db.server1470.update({
"name": "first",
"pic": {"$ref": "foo", "$id": ObjectId("4c48d04cd33a5a92628c9af6")}
}, {$set: {x: 1}}, true, true);`
"pic" field is skipped and not inserted in the collection.
Changes includes:
1. Support $ref and $id in upsert case
2. handle error cases
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request adds support for DBRef in upsert operations.
- Modified `bson_query.c` to handle `$ref` and `$id` operators during upsert.
- Updated `query_operator.c` to include error handling for DBRef fields.
- Added new test cases in `commands_update.sql` and `commands_update.out` to validate DBRef upsert functionality.
- Introduced new error codes in `helio_errors.h`, `helio_codes.txt`, and related CSV files for DBRef validation errors.
### 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
move sql files into pg_documentdb_distributed
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request moves SQL files from `pg_helio_distributed` to `pg_documentdb_distributed` as part of a reorganization effort.
- `documentdb_distributed--0.24-0.sql`: Added schema creation and table setup for `helio_api_distributed`.
- Updated file paths in `pgmongo--1.20-0--1.21-0.sql`, `pg_helio_distributed--1.21-0.sql`, `pg_helio_distributed--1.23-0--1.24-0.sql`, and `pgmongo--1.23-0--1.24-0.sql` to reflect the new location in `pg_documentdb_distributed`.
- `validate_helio_extension_state.sh`: Added exceptions for the newly moved SQL files.
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Infra
### 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
Symbol upload was still broken. Fix it so that it supports repeatable builds and installs the stripped so file in the target (but doesn't overwrite build output).
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
This pull request addresses issues with symbol extraction and handling in the build process.
- `/scripts/makefile.symbols`: Refactored symbol extraction and installation process, added `strip-installed-lib` target.
- `/pgmongo/Makefile`: Fixed symbol file copying process.
- `/.gitignore`: Added `.dbg` files to ignore list.
### 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))
### Description
Move type/operator/schema files from pg_helio_api -> pg_documentdb
Except udf files
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request moves type, operator, and schema files from the `pg_helio_api` directory to the `pg_documentdb` directory.
- Updated SQL include paths in multiple `pg_helio_api` SQL files to reference `pg_documentdb` directory.
- Modified `pgmongo` SQL files to include paths from `pg_documentdb` instead of `pg_helio_api`.
- Adjusted `validate_helio_extension_state.sh` script to account for new file paths.
- Updated `Makefile` in `pg_helio_api` to include the new directory structure.
- Changed include paths in `pg_documentdb_distributed` and `pg_helio_distributed` C source files to reflect the new directory structure.
### Does this PR have any customer impact?
No
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Perf/Testing
### 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 up symbols for docdb not getting published
----
#### AI description (iteration 1)
#### PR Classification
Bug fix for publishing symbols in the docdb project.
#### PR Summary
This pull request refactors the Makefile setup to fix issues with publishing symbols for docdb.
- `Makefile` changes in `pg_documentdb_distributed`, `pg_documentdb`, and `pg_documentdb_core` to include a new global Makefile.
- Added a new `Makefile.global` to centralize common Makefile configurations.
- Updated `install_setup_pgmongo.sh` to set `EXTRA_INCLUDE_MAKEFILE` for symbol extraction.
### 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
Finish up schema migration for documentdb_core
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request finalizes the migration of schema from `helio_core` to `Documentdb_Core`.
- Updated function definitions in `oss/pg_documentdb_core/sql/udfs/bson_io/bson_io--0.11-0.sql` to use `__CORE_SCHEMA__`.
- Updated function definitions in `oss/pg_documentdb_core/sql/udfs/bson_btree/bson_btree--0.19-0.sql` to use `__CORE_SCHEMA__`.
- Updated function definitions in `oss/pg_documentdb_core/sql/udfs/bsonsequence_io/bsonsequence_io--0.10-0.sql` to use `__CORE_SCHEMA__`.
- Removed `set search_path` statements from `oss/pg_documentdb_core/sql/documentdb_core--0.24-0.sql`.
- Updated function definitions in `oss/pg_documentdb_core/sql/udfs/bson_hash/bson_hash_functions--0.15-0.sql` to use `__CORE_SCHEMA__`.
### 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
Start porting schemas for SQL in documentdb_core.
Maintain back-compat by introducing CORE_SCHEMA_v2 to handle cases where the existing logic already depends on there being 2 core schemas
----
#### AI description (iteration 1)
#### PR Classification
Code refactoring to port schemas into `documentdb_core`.
#### PR Summary
This pull request refactors the code to port BSON type definitions and related functions into `documentdb_core`.
- `pg_helio_core/sql/types/bson--1.10-0.sql`: Replaced BSON type definitions with an include directive.
- Added `pg_documentdb_core/sql/types/bson--0.24-0.sql` and `pg_documentdb_core/sql/types/bson_typanalyze--0.24-0.sql` for BSON type and analysis functions.
- `pg_documentdb_core/sql/documentdb_core--0.24-0.sql`: Created `documentdb_core` schema and included BSON type definitions.
- Updated Makefiles (`Makefile.cflags`, `pg_helio_api/Makefile`, `pg_helio_core/Makefile`, `internal/pg_helio_distributed/Makefile`) to include new schema definitions.
- Updated `postgresql.conf` files to preload `pg_documentdb_core`.
### 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
1) In point read wtih `$near`/`$nearSphere` disable the optimization since it creates subqueries
2) Remove projections that are "resJunk" since we're not sorting with the point read.
3) Refactor getting the filters into a separate method.
----
#### AI description (iteration 2)
#### PR Classification
Bug fix
#### PR Summary
This pull request addresses bugs in the custom planner related to point read plans and improves the handling of projections and query qualifications.
- `documents_custom_planner.c`: Added functions `SetPointReadQualsOnIndexScan` and `FormatProjections` to handle point read qualifications and projections more effectively.
- `bson_aggregation_pipeline_tests_point_read.out`: Updated expected output to reflect changes in query plans and error handling.
- `bson_aggregation_pipeline.c`: Added a check to invalidate point read plans when pushing to a subquery.
- `bson_aggregation_pipeline_tests_point_read.sql`: Added new test cases for special operators in filters.
### Does this PR have any customer impact?
Yes
### 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
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Improve performance for a point read set up for unsharded collections.
In the scenario where we have a point read in a local unsharded collection with colocation, we can bypass a lot of the planner and go directly to the PK index. Use this to simplify the planner.
With this change, point reads on YCSB are able to hit ~16k on Marlin and ~17.5-18k on flex
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
Introduces a custom planner for point read operations to optimize query performance.
- Added `documents_custom_planner.c` to implement the custom point read planner.
- Updated `aggregation_commands.c` to handle the new point read cursor type.
- Modified `planner.c` to integrate the custom point read planner and expand aggregation functions.
### 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))
### Description
Remove helio references from documentdb
Remove helio references from documentdb_distributed
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request removes references to "helio" and replaces them with "documentdb" in the sources of `documentdb` and `documentdb_distributed`.
- `metadata_cache.h` and `metadata_cache.c`: Replaced "Helio" with "DocumentDB" in variable names and function names.
- `pgmongo.c`: Updated include statements and function calls to use "documentdb" instead of "helio".
- `planner.c`: Updated planner function and related calls to use "DocumentDBApiPlanner".
- Moved several header files from `helio_*` to `documentdb_*` naming convention without code changes.
- `commands_common.c` and `create_indexes.c`: Updated function calls and variable names to use "DocumentDB" instead of "Helio".
### 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
move sql files from helio_core -> documentdb_core for schema files
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request moves SQL files from `helio_core` to `documentdb_core` to better organize schema files.
- Updated includes in `oss/pg_helio_core/sql/pg_helio_core--1.10-0.sql` to reference `pg_documentdb_core` paths.
- Modified `pgmongo/sql/pgmongo--1.14-6--1.15-0.sql` to include files from `pg_documentdb_core` instead of `pg_helio_core`.
- Adjusted `scripts/pipeline_check_sql_upgrades.sh` to validate and check SQL files in `pg_documentdb_core`.
- Updated `oss/pg_helio_core/Makefile` to include `OSS_SRC_DIR` for SQL file processing.
- Changed various `pgmongo/sql` files to reference `pg_documentdb_core` paths for BSON-related operations and schema definitions.
### 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
In `db.date_from_string_on_null.aggregate(
{$project: {date: {$dateFromString: {dateString: "$missing", onNull: "$missing"}}}})` case,
type of onNull would be BSON_TYPE_EOD, which result in error "unknown BSON type code 0". Add special logic in `HandlePreParsedDollarDateFromString` to handle it.
Unit test was added as well.
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
Fixes an error when the `onNull` type is `BSON_TYPE_EOD` in the `$dateFromString` operator.
- `oss/pg_documentdb/src/operators/bson_expression_date_operators.c`: Added a check to return directly if `onNull` type is `BSON_TYPE_EOD`.
- `oss/internal/pg_helio_distributed/src/test/regress/expected/bson_aggregation_date_operators_tests.out` and `oss/internal/pg_helio_distributed/src/test/regress/sql/bson_aggregation_date_operators_tests.sql`: Added test cases to validate the fix.
### 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?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
- Redo GUCs for helio -> documentdb preserving back-compat for the service.
- Move Docdb version to 1.24 -> 0.24
----
#### AI description (iteration 1)
#### PR Classification
API change
#### PR Summary
This pull request updates the prefix for all GUCs (Grand Unified Configuration) to a neutral prefix.
- `documentdb_init.c`: Changed GUCs from "helio_api" to a dynamic prefix using `psprintf`.
- `documentdb_distributed_init.c` and `documentdb_distributed.c`: Updated GUCs to use a dynamic prefix.
- `pg_documentdb.c`, `pg_helio_api.c`, and `pgmongo.c`: Modified initialization functions to pass the new GUC prefix.
- `helio_api_init.h` and `helio_distributed_init.h`: Updated function signatures to include the new GUC prefix parameter.
- Updated control files to reflect the new version `0.24-0`.
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
- Push Aggregation queries directly to shard if the collection is unsharded in a single node and pipeline stages refer only 1 collection
### Description
Push Aggregation queries directly to shard if the collection is unsharded in a single node and pipeline stages refer only 1 collection
----
#### AI description (iteration 1)
#### PR Classification
Performance improvement
#### PR Summary
This pull request optimizes the aggregation pipeline by pushing aggregates directly to shards for unsharded tables in a single node setup.
- Added tests in `bson_aggregation_pipeline_tests.out` to verify the new optimization for unsharded collections.
- Updated `bson_aggregation_pipeline_tests.out` in both `pg_helio_distributed` and `helio_compat` to include new test cases and EXPLAIN plans demonstrating the performance improvements.
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Cursors with SRFs caused crashes when not run via citus. Fix this behavior..
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
This pull request fixes an issue with cursor handling in the `HoldPortal` function.
- `cursors.c`: Ensures that the cursor options include `CURSOR_OPT_SCROLL` to support backwards scanning.
### 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
Expects MongoDB error code 73 with collection name has invalid type object message. Not MongoDB error code 26 (M0008).
postgres=# SELECT * FROM helio_api.validate('test','{"validate":{}}');
ERROR: BSON field 'validate' is the wrong type 'object', expected type 'string'
postgres=# \errverbose
ERROR: M0004: BSON field 'validate' is the wrong type 'object', expected type 'string'
LOCATION: ThrowTopLevelTypeMismatchError, parse_error.h:24
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
This pull request addresses an issue with the `helio_api.validate` function returning an incorrect error code.
- Modified `oss/pg_helio_api/src/commands/validate.c` to check if the `validate` field is of type `BSON_TYPE_DOCUMENT` and return the appropriate error message and code.
Related work items: #3658791
### 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))
### Description
Remove helio from file name
Remove helio references from source content except schema reference
Start local documentdb server with the documentdb extension
Regression tests using the documentdb extension
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request removes references to "helio" from the `documentdb_core` source code.
- `scripts/utils.sh`: Renamed variables from `preloadExtensions` to `preloadLibraries`.
- `pg_documentdb_core/include/utils/error_utils.h`: Updated function and macro names to replace "Helio" with "DocumentDB".
- `pg_documentdb_core/include/io/helio_bson_core.h` and `pg_documentdb_core/include/query/helio_bson_compare.h`: Moved to `pg_documentdb_core/include/io/bson_core.h` and `pg_documentdb_core/include/query/bson_compare.h`.
- `pg_documentdb_core/src/collation/collation.c` and `pg_documentdb_core/src/io/pgbson.c`: Replaced error codes and messages to use "DocumentDB" instead of "Helio".
- `scripts/validate_helio_extension_state.sh`: Added exceptions for certain files to skip validation for "helio" references.
### 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] remove dependencies on helio errors
### 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] remove mongo_data references
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request removes references to `mongo_data` and replaces them with `documentdb_data` across the codebase.
- `collection.h`: Updated constants and macros to use `DOCUMENTDB` instead of `MONGO`.
- `drop_indexes.c`, `create_indexes.c`, `insert.c`: Replaced `MONGO_DATA` table and index format strings with `DOCUMENTDB_DATA`.
- `planner.c`, `bson_aggregation_output_pipeline.c`, `bson_aggregation_pipeline.c`: Updated attribute number constants and variable names.
- `index.h`: Changed index name format prefixes from `MONGO_DATA` to `DOCUMENTDB_DATA`.
- `shard_colocation.c`: Adjusted table prefix strings and comments to reflect the new naming convention.
### 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?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
- Cluster Data was not replicated fully on add node (upgrades would fail)
- Checks for index wasn't handled in add-node scenarios. (Create/Drop indexes would fail)
- Get versions on the GW on MX of the added node reutrns NullRef - fix these.
----
#### AI description (iteration 1)
#### PR Classification
Bug fix for add-node scenarios.
#### PR Summary
This pull request addresses issues related to ensuring metadata tables are properly replicated during add-node operations.
- `distributed_hooks.c`: Refactored `EnsureMetadataTableReplicatedCore` to return a boolean and added `ExecuteMetadataChecksForReferenceTables`.
- `create_indexes_background.c`: Added checks to ensure metadata tables are replicated before starting index creation.
- `cluster_operations.c`: Ensured `cluster_data` table is replicated on all nodes during cluster setup.
- `api_hooks.c` and `api_hooks.h`: Modified `EnsureMetadataTableReplicated` to return a boolean indicating if replication occurred.
- `ExtensionVersionExtensions.cs`: Added null checks for version strings before writing them.
### 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
[Perf] Optimize $merge "merge" option
----
#### AI description (iteration 1)
#### PR Classification
Performance optimization:
Single document in collection and each entry is average of 10 runs.

#### PR Summary
This pull request optimizes the `$merge` "merge" option by improving the handling of BSON elements.
- `bson_aggregation_output_pipeline.c`: Replaces the tree-based approach with a hash table to manage BSON elements, ensuring order and improving performance.
- Adds new functions and data structures for creating and managing an ordered hash set of BSON elements.
### 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 source files under new directory.
----
#### AI description (iteration 1)
#### PR Classification
Code reorganization
#### PR Summary
This pull request moves the `helio_api` and `helio_distributed` sources under the `documentdb` directory, updating references and initialization logic accordingly.
- Added `pg_documentdb.c` for initializing the `pg_documentdb` extension.
- Added `documentdb_distributed.c` for initializing the `pg_documentdb_distributed` extension.
- Updated `validate_helio_extension_state.sh` to include new checks for `documentdb`.
- Moved `helio_api_extension_version.c` to `documentdb_extension_version.c` without code changes.
- Updated various `Makefile` configurations to reflect the new directory structure and dependencies.
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Bugfixes
### 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
1) The first DDL after add-node needs to replicate reference tables. Since we're already in a broken state, just use block_writes in this path (we can go faster in this path)
2) For back-compat scenarios in upgrade, add ALTER TABLE DROP CONSTRAINT IF EXISTS cluster_data_pkey in the next upgrade
3) Shard_collection broke the colocation of main and retry tables. Ensure that they are colocated under a guc.
Still TODO:
Create a new config collection for rebalance_table_shards_plan().
----
#### AI description (iteration 1)
#### PR Classification
Bug fix and code improvement from cluster investigations.
#### PR Summary
This pull request addresses issues found during cluster investigations, focusing on retry table creation and sharding improvements.
- `create_collection_core.c`: Refactored to create a separate `CreateRetryTable` function and adjusted table creation logic.
- `sharding.c`: Added logic to recreate retry tables during sharding if the `RecreateRetryTableOnSharding` flag is enabled.
- `helio_api_init.c`: Introduced a new configuration variable `RecreateRetryTableOnSharding`.
- `command_shard_commands.sql` and `command_shard_commands.out`: Updated tests to validate the new retry table creation logic.
- `collection.h`: Added declaration for the new `CreateRetryTable` function.
### 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 c files from pg_helio_core -> pg_documentdb_core
- Make helio_core, and other extensions depend on pg_documentdb_core as a lib dependency
----
#### AI description (iteration 1)
#### PR Classification
Code reorganization
#### PR Summary
This pull request moves source files from `pg_helio_core` to `pg_documentdb_core` to better organize the project structure.
- Deleted `oss/pg_helio_core/include/utils/helio_codes.txt`.
- Added `oss/pg_documentdb_core/src/pg_documentdb_core.c` for initializing the shared library.
- Updated `oss/Makefile.cflags` to include new paths and installation rules for `pg_documentdb_core`.
- Moved `oss/pg_helio_core/src/bson_init.c` and `oss/pg_helio_core/include/bson_init.h` to `oss/pg_documentdb_core/src/bson_init.c` and `oss/pg_documentdb_core/include/bson_init.h` respectively.
- Modified various `Makefile` files to set `USE_DOCUMENTDB_CORE` and adjust include paths.
### 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))
### Description
Add [-t] - optional argument. serverType is the type of server to start.
Supported values are helio and documentdb, default is helio"
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request adds an option for starting a DocumentDB server and includes some script adjustments.
- Moved `oss/scripts/start_helio_server.sh` to `oss/scripts/start_oss_server.sh`.
- Updated `oss/scripts/utils.sh` to support additional preload extensions for PostgreSQL configurations.
### 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))
### Description
Add "make check" support into pg_documentdb, pg_documentdb_core, pg_documentdb_distributed
Add one test "public_api_schema.sql"
----
#### AI description (iteration 1)
#### PR Classification
Initial test setup for DocumentDB.
#### PR Summary
This pull request sets up the initial testing framework for DocumentDB, including validation scripts and Makefile configurations.
- Added `validate_test_output.sh` scripts for both `pg_documentdb` and `pg_documentdb_distributed` to validate test outputs.
- Introduced custom diff tools (`diff` and `diff-filter`) in `pg_documentdb_distributed` for normalizing and comparing test results.
- Created `Makefile` for `pg_documentdb` and `pg_documentdb_distributed` to define test execution commands and configurations.
- Added `public_api_schema.out` files in `pg_documentdb` and `pg_documentdb_core` to validate the public API schema.
### 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)
Not yet
### 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
Initial setup for documentdb extensions.
Create Makefiles and set up build scripts around documentdb.
This does not yet touch the actual code or make anything deployable.
----
#### AI description (iteration 1)
#### PR Classification
Initial setup for DocumentDB integration.
#### PR Summary
This pull request sets up the initial structure and configuration for DocumentDB integration.
- Added `documentdb_errors.h` for defining DocumentDB-specific error codes.
- Created `Makefile` for `pg_documentdb`, `pg_documentdb_core`, and `pg_documentdb_distributed` to handle build configurations.
- Updated `validate_helio_extension_state.sh` and `validate_headers.sh` scripts to include checks for DocumentDB.
- Modified `bson_aggregation_nested_pipeline.c`, `bson_aggregation_vector_search.c`, and other source files to replace references from Helio to DocumentDB.
- Added control files for `pg_documentdb`, `pg_documentdb_core`, and `pg_documentdb_distributed` extensions.
### 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
Hash Comparator expected to return 0, +ve int and -ve int but but currently returning 0/1.
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
This pull request fixes the hash comparator function for `PgbsonElement` in the `pg_helio_core` module.
- `oss/pg_helio_core/src/utils/hashset_utils.c`: Corrected the comparison logic to handle path length and string comparison more accurately, ensuring proper hash entry comparison. Updated the function documentation to reflect the new return values.
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Features
### 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))
Enable shard_collection, reshard_collection, unshard_collection with more mongo options.
Moves core processing of this to the backend.
also introduces shard rebalancing APIs
### Description
Enable shard_collection, reshard_collection, unshard_collection with more mongo options.
Moves core processing of this to the backend.
also introduces shard rebalancing APIs
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request enables sharding commands for pgmongo.
- `src/sharding/sharding.c`: Added functions to handle sharding, resharding, and unsharding collections, including `ShardCollectionLegacy`, `ShardCollectionCore`, `ParseNamespaceName`, `ParseShardCollectionRequest`, `ParseReshardCollectionRequest`, and `ParseUnshardCollectionRequest`.
### 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
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
This pull request addresses a bug related to unique index truncation by implementing a recheck mechanism.
- `oss/pg_helio_api/src/opclass/rum_exclusion.c`: Implemented `bson_unique_shard_path_equal` function to compare BSON documents for unique shard paths.
- Added `GetUniqueShardDocumentTermsHTAB` utility function to create a hash table of terms from a unique shard document.
- Adjusted include order and added new includes for required utilities.
- Changed `indexTermTruncateLimit` from `UINT32_MAX` to `INT32_MAX` in `generate_unique_shard_document`.
Related work items: #3291671, #3458782
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
support $natural:-1 scenario
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request adds support for the `$natural:-1` sort scenario in the aggregation pipeline.
- `src/aggregation/bson_aggregation_pipeline.c`: Added logic to handle `$natural` sort by introducing a `WindowClause` and using the `row_number()` function for sorting.
- Included necessary headers for function lookup and parsing.
Related work items: #3066471
### 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?
No
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
Handling of wildcard text indexes when compounded with a non-wildcard field is broken. This bug is a **functional bug** affecting query results when used with a wildcard index (see JS test for repro).
----
#### AI description (iteration 1)
#### PR Classification
Bug fix to correct the handling of compound wildcard text indexes.
#### PR Summary
This pull request addresses a bug in the handling of compound wildcard text indexes by adding additional tests and correcting the index creation and listing logic.
- Modified `commands_create_indexes_text.out` to include more tests and correct the handling of compound wildcard text indexes.
- Added new test file `text_indexes_wildcard.js` to verify the correct behavior of wildcard text indexes.
- Updated `commands_create_indexes_text.sql` to include additional test cases for compound wildcard text indexes.
### Does this PR have any customer impact?
Yes it implements the option `StartAtOperationTimeStamp` for change streams.
### 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
This PR implements support for historical change streams using `StartAtOperationTimeStamp` option.
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request implements historical change streams with direct WAL decoding for MongoDB.
- `change_stream_wal_utils.c`: Added functions to determine the oldest available WAL segment and to check if a transaction is later than a given timestamp.
- `change_stream.h`: Removed `ChangeStreamSpec` struct and added `startTimestamp` to `ChangeStreamContext`.
- `change_stream_aggregation_stage.c`: Added support for `startAtOperationTime` to start change streams from a specific operation time.
- `change_stream_decoding_utils.c`: Added function to convert BSON timestamp to `TimestampTz`.
Related work items: #2973720
### 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 a limit of 10 users for dataplane user crud api
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request enforces a limit of 10 users for the Dataplane user CRUD API.
- `oss/pg_helio_api/src/commands/users.c`: Added logic to check and enforce the maximum user limit before creating a new user.
- `oss/pg_helio_api/src/helio_api_init.c`: Introduced a new configuration variable `helio_api.maxUserLimit` to set the maximum number of users allowed.
- `pgmongo/src/test/regress/sql/user_crud_commands.sql` and `pgmongo/src/test/regress/expected/user_crud_commands.out`: Added tests to verify the user limit enforcement and behavior when the limit is exceeded.
Related work items: #3175767
### 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
Push sort by _id down to the primary key index on unsharded or when we have a shard key
----
#### AI description (iteration 1)
#### PR Classification
Code optimization
#### PR Summary
This pull request optimizes the sorting mechanism by pushing the sort by `_id` down to the primary key index when applicable.
- Added `CanSortByObjectId` and `HasShardKeyFilterWalker` functions in `bson_aggregation_pipeline.c` to determine if sorting by `_id` can be optimized.
- Modified `HandleSort` function in `bson_aggregation_pipeline.c` to use the new optimization logic for sorting by `_id`.
- Updated function declarations in `bson_aggregation_pipeline.c` to include the new helper functions.
### 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 up update to only do upsert if the query was exactly on _id. other cases should defer to insert (and fail on unique conflict)
----
#### AI description (iteration 1)
#### PR Classification
Bug fix to ensure upsert operations are only performed when the query is on `_id`.
#### PR Summary
This pull request modifies the upsert logic to only perform upserts if the query is solely based on the `_id` field.
- Updated `update.c` to check for queries with only `_id` filters and renamed related variables for clarity.
- Added test cases in `commands_update.out` and `commands_update.sql` to verify upsert behavior and handle error cases.
### Does this PR have any customer impact?
Yes
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Bug fixes
### 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?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
1) send server group name in node metrics from backend
2) in collstats cap the avg obj size so it doesn’t go below storage size
3) skip run command on all nodes for single node
4) set the multinode behavior in distributed extension
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup and enhancement for service debugging.
#### PR Summary
This pull request includes various improvements and cleanups identified during service debugging.
- `pg_helio_distributed/src/test/regress/expected/commands_update.out`: Updated SQL command execution notices to use `helio_api_internal.update_worker`.
- `pgmongo/src/infrastructure/mdsd_logger.c`: Added functions to load default dimensions and append server group details to logs. Removed the `append_internal_logs` function.
### 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
[Code cleanup] Remove dead code for old aggregation operator framework
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request removes dead code related to the old aggregation operator framework.
- Removed unused functions and variables in `src/operators/bson_expression.c`.
- Deleted legacy operator handling functions in `src/operators/bson_expression.c`.
- Cleaned up `include/operators/bson_expression_operators.h` by removing obsolete function declarations and typedefs.
- Updated `src/aggregation/bson_aggregation_nested_pipeline.c` to use the new aggregation expression evaluation functions.
- Removed legacy function declarations from `include/operators/bson_expression.h`.
### Does this PR have any customer impact?
no
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
testing
### 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
Don't ignore spaces in OSS tests - honor space changes as diffs
----
#### AI description (iteration 1)
#### PR Classification
Bug fix for OSS tests to ensure spaces are not ignored.
#### PR Summary
This pull request addresses the issue of spaces being ignored in OSS tests by correcting the expected output formatting.
- `oss/internal/pg_helio_distributed/src/test/regress/expected/bson_aggregation_type_operators_tests.out`: Adjusted the expected output to include spaces in the `bson_dollar_project` results.
### 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
- Delete old feature flags that are default on for a while.
- Remove ClusterVersion checks < 1.19
----
#### AI description (iteration 1)
#### PR Classification
Code cleanup
#### PR Summary
This pull request focuses on cleaning up feature flags in the codebase.
- Removed feature flag checks and related code in `bson_aggregation_pipeline.c`.
- Updated test outputs in `bson_aggregation_stage_merge_tests.out` files.
- Removed feature flag settings in `bson_index_truncation_index_tests.sql`.
- Deleted unused function `GetMergeDocumentsFunctionOid` in `bson_aggregation_pipeline_private.h`.
- Removed feature flag definitions in `helio_api_init.c`.