summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher/expression_algo.cpp
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2016-06-03 10:49:24 -0400
committerTess Avitabile <tess.avitabile@mongodb.com>2016-06-03 16:59:47 -0400
commit10e662cad7fe15581c6c499b934b7d4fd3a1e83d (patch)
tree2decfc9142283d0b9b9ea505350e7955859dbeb9 /src/mongo/db/matcher/expression_algo.cpp
parent8d51acc6890304e4c8a4e7b397504d8e5717beff (diff)
downloadmongo-10e662cad7fe15581c6c499b934b7d4fd3a1e83d.tar.gz
SERVER-24392 Remove invalid invariant in expression::isSubsetOf()
Diffstat (limited to 'src/mongo/db/matcher/expression_algo.cpp')
-rw-r--r--src/mongo/db/matcher/expression_algo.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mongo/db/matcher/expression_algo.cpp b/src/mongo/db/matcher/expression_algo.cpp
index 966c727501f..1b130592597 100644
--- a/src/mongo/db/matcher/expression_algo.cpp
+++ b/src/mongo/db/matcher/expression_algo.cpp
@@ -95,14 +95,16 @@ bool _isSubsetOf(const ComparisonMatchExpression* lhs, const ComparisonMatchExpr
return false;
}
- // Either collator may be used by compareElementValues() here. If lhs (the query) contains
- // string comparison, then _isSubsetOf will only be called if lhs and rhs have the same
- // collator. Otherwise, the collator will not be used by compareElementValues().
if (!CollatorInterface::collatorsMatch(lhs->getCollator(), rhs->getCollator())) {
// TODO SERVER-23172: Check that lhsData does not contain string comparison in nested
// objects or arrays.
- invariant(lhsData.type() != BSONType::String);
+ if (lhsData.type() == BSONType::String) {
+ return false;
+ }
}
+
+ // Either collator may be used by compareElementValues() here, since either the collators are
+ // the same or lhsData does not contain string comparison.
int cmp = compareElementValues(lhsData, rhsData, rhs->getCollator());
// Check whether the two expressions are equivalent.