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

Symbol BSON type compares incorrectly with String when the collation is non-simple

    • Query Execution
    • v3.4

      The original design for the collation feature specified that collation-aware string comparison would only apply to BSONType::String. However, in all existing versions, String and Symbol have been considered the same canonical type, meaning that String "a" == Symbol "a", String "a" < Symbol "b" and Symbol "a" < String "b".

      As currently implemented, we only translate String (not Symbol) to the corresponding ICU comparison key. Therefore, translated String comparison keys will be compared directly to raw, untranslated Symbols in indexes with a collation. Such indexes are broken. Furthermore, comparisons between Symbol and String may not have a total order, since we only use the collator in the comparison if String is on the left-hand side. There may also be places in the query planner which are incorrect if the query involves the combination of Symbol and Collation.

            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            david.storch@mongodb.com David Storch
            0 Vote for this issue
            21 Start watching this issue