From 26543060c852aac22f26143a04bf7789ec8fec53 Mon Sep 17 00:00:00 2001 From: David Storch Date: Fri, 12 Aug 2016 15:58:56 -0400 Subject: SERVER-24508 BSONObj::ComparatorInterface BSONObj instances should now be compared via the comparator interface's evaluate() method. This preferred over using BSONObj::woCompare() directly. If the comparison doesn't require any database semantics (e.g. there is no collation), there is a global instance of the SimpleBSONObjComparator which should be used for BSONObj comparisons. If the comparison requires special semantics, then callers must instantiate their own comparator object. --- src/mongo/db/query/index_bounds.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/mongo/db/query/index_bounds.cpp') diff --git a/src/mongo/db/query/index_bounds.cpp b/src/mongo/db/query/index_bounds.cpp index 85708c6c09c..065d53ba510 100644 --- a/src/mongo/db/query/index_bounds.cpp +++ b/src/mongo/db/query/index_bounds.cpp @@ -32,6 +32,8 @@ #include #include +#include "mongo/bson/simple_bsonobj_comparator.h" + namespace mongo { using std::string; @@ -100,8 +102,9 @@ bool IndexBounds::operator==(const IndexBounds& other) const { } if (this->isSimpleRange) { - return std::tie(this->startKey, this->endKey, this->endKeyInclusive) == - std::tie(other.startKey, other.endKey, other.endKeyInclusive); + return SimpleBSONObjComparator::kInstance.evaluate(this->startKey == other.startKey) && + SimpleBSONObjComparator::kInstance.evaluate(this->endKey == other.endKey) && + (this->endKeyInclusive == other.endKeyInclusive); } if (this->fields.size() != other.fields.size()) { -- cgit v1.2.1