[SERVER-84462] Consider offering a way for $toHashedIndexKey expression to apply a collation Created: 29/Dec/23  Updated: 18/Jan/24

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-82815 Expose server’s index key creation vi... Closed
is related to SERVER-49214 Add $toHashedIndexKey expression Closed
Assigned Teams:
Query Execution
Participants:

 Description   

$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).


Generated at Thu Feb 08 06:55:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.