mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-08 11:55:30 -05:00
### 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