Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-84462

Consider offering a way for $toHashedIndexKey expression to apply a collation

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      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).

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: