-
Type: New Feature
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
$toHashedIndexKey was added as a public aggregation expression as part of the resharding project by SERVER-49214. Sharded collections are always partitioned according to the "simple" collation independent of the collection's default collation. Notably, the $toHashedIndexKey expression does not convert strings in its argument to their equivalent collation key even if the aggregate command is running with a non-"simple" collation. The current behavior must be preserved for the correctness of resharding.
However, it is possible to have a hashed index with a non-"simple" collation where CollationIndexKey::collationAwareIndexKeyAppend() is called by ExpressionKeysPrivate::getHashKeys() to convert strings into their equivalent collation key prior to hashing the collation key. If we believe an application may be using such a hashed index and would want to use $toHashedIndexKey to mimic the hashed index behavior then we should add a way for $toHashedIndexKey to accept a collation. Otherwise this could reasonably wait until support for sharded collections partitioned according to a non-"simple" collation is added (PM-1930).
- is related to
-
SERVER-82815 Expose server’s index key creation via aggregation
- Closed
-
SERVER-49214 Add $toHashedIndexKey expression
- Closed