mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-08 03:52:41 -05:00
### 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 Our Collstats response is not line with the native mongo response. Native mongo behaviour : 1) When we run collstats the response size and all fields are expected to be Int32 2) If they overflow the range for int32 in response the output is of type double With this pr we change the PgbsonWriter to reflect the same functionality while sending final response ---- #### AI description (iteration 1) #### PR Classification Bug fix for failing `coll_stats` JavaScript test. #### PR Summary This pull request addresses a bug in the `coll_stats` function by ensuring the correct data type is used for various statistics. It modifies the test output and the core implementation to handle integer and double values appropriately. - `/pgmongo/src/test/regress/expected/commands_coll_stats.out`: Updated expected output to reflect correct data types (`$numberInt` and `$numberLong`). - `/oss/pg_helio_api/src/commands/coll_stats.c`: Introduced `WriteStatsAsIntorDouble` helper function to decide whether to write stats as `int32` or `double`. Updated `WriteCoreStorageStats` and `BuildEmptyResponseMessage` to use this helper function.