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.
- related to
-
SERVER-27195 Symbol BSON type compares incorrectly with String when the collation is non-simple
- Backlog
-
SERVER-27200 Comparison of the scope object in a BSON element of type CodeWScope should not respect the collation
- Closed