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


    • Type: Bug
    • Status: Open
    • Priority: Critical - P2
    • Resolution: Unresolved
    • Affects Version/s: 3.4.0-rc5
    • Fix Version/s: Backlog
    • Component/s: Querying
    • Labels:
    • Backport Requested:


      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.


          Issue Links



              • Votes:
                0 Vote for this issue
                18 Start watching this issue


                • Created: