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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Backlog
    • Critical - P2
    • Resolution: Unresolved
    • 3.4.0-rc5
    • None
    • Querying
    • Query Execution
    • v3.4

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              backlog-query-execution Backlog - Query Execution
              david.storch@mongodb.com David Storch
              Votes:
              0 Vote for this issue
              Watchers:
              19 Start watching this issue

              Dates

                Created:
                Updated: