[SERVER-27197] Code BSON type should not be compared using a collation-aware string comparator Created: 28/Nov/16  Updated: 05/Apr/17  Resolved: 06/Dec/16

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 3.4.1, 3.5.1

Type: Bug Priority: Critical - P2
Reporter: David Storch Assignee: David Storch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-27195 Symbol BSON type compares incorrectly... Backlog
related to SERVER-27200 Comparison of the scope object in a B... Closed
Backwards Compatibility: Fully Compatible
Backport Completed:
Sprint: Query 2016-12-12
Participants:

 Description   

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.



 Comments   
Comment by Githook User [ 06/Dec/16 ]

Author:

{u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}

Message: SERVER-27197 fix BSONType::Code comparison to not use collator

(cherry picked from commit 6f1824c8ff3b211f72e706de32b9637750cccf1e)
Branch: v3.4
https://github.com/mongodb/mongo/commit/90a3e41da4a7d9f0c9fae08e2babdb33600dc916

Comment by Githook User [ 06/Dec/16 ]

Author:

{u'username': u'dstorch', u'name': u'David Storch', u'email': u'david.storch@10gen.com'}

Message: SERVER-27197 fix BSONType::Code comparison to not use collator
Branch: master
https://github.com/mongodb/mongo/commit/6f1824c8ff3b211f72e706de32b9637750cccf1e

Generated at Thu Feb 08 04:14:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.