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

Code BSON type should not be compared using a collation-aware string comparator

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 3.4.1, 3.5.1
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • Fully Compatible
    • Query 2016-12-12

      BSONElement::compareElementValues() can incorrectly use a collation-aware StringData comparator when comparing values of BSONType::Code:

      https://github.com/mongodb/mongo/blob/r3.4.0-rc5/src/mongo/bson/bsonelement.cpp#L945-L961

      Only BSONType::String and possibly BSONType::Symbol (see related issue SERVER-27195) should ever make comparisons using a StringData comparator. As a consequence, queries involving Code values which have a non-simple collation may return the wrong data or may sort the data incorrectly.

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: