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/matcher/expression_where_base.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/mongo/db/matcher/expression_where_base.cpp') diff --git a/src/mongo/db/matcher/expression_where_base.cpp b/src/mongo/db/matcher/expression_where_base.cpp index 21b746e13ab..6b0022a7e94 100644 --- a/src/mongo/db/matcher/expression_where_base.cpp +++ b/src/mongo/db/matcher/expression_where_base.cpp @@ -30,6 +30,8 @@ #include "mongo/db/matcher/expression_where_base.h" +#include "mongo/bson/simple_bsonobj_comparator.h" + namespace mongo { WhereMatchExpressionBase::WhereMatchExpressionBase(WhereParams params) @@ -55,7 +57,8 @@ bool WhereMatchExpressionBase::equivalent(const MatchExpression* other) const { return false; } const WhereMatchExpressionBase* realOther = static_cast(other); - return getCode() == realOther->getCode() && getScope() == realOther->getScope(); + return getCode() == realOther->getCode() && + SimpleBSONObjComparator::kInstance.evaluate(getScope() == realOther->getScope()); } } // namespace mongo -- cgit v1.2.1