diff options
author | Jess Balint <jbalint@gmail.com> | 2022-02-22 22:39:19 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-02-22 23:32:44 +0000 |
commit | 54b918d73c63483faecedb807722a707ba0e64c2 (patch) | |
tree | 2b92e04f078c82e63a02f6c37285b3be222c8a47 /src/mongo/db/query/query_planner_test_lib.cpp | |
parent | 6be53022af440793953d1e39725f38b728bcb155 (diff) | |
download | mongo-54b918d73c63483faecedb807722a707ba0e64c2.tar.gz |
SERVER-40691 $nin:[[],...] queries are not indexed #3420
Diffstat (limited to 'src/mongo/db/query/query_planner_test_lib.cpp')
-rw-r--r-- | src/mongo/db/query/query_planner_test_lib.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mongo/db/query/query_planner_test_lib.cpp b/src/mongo/db/query/query_planner_test_lib.cpp index 1d78d8a086d..695418cc84f 100644 --- a/src/mongo/db/query/query_planner_test_lib.cpp +++ b/src/mongo/db/query/query_planner_test_lib.cpp @@ -84,8 +84,13 @@ Status filterMatches(const BSONObj& testFilter, return statusWithMatcher.getStatus().withContext( "match expression provided by the test did not parse successfully"); } - const std::unique_ptr<MatchExpression> root = std::move(statusWithMatcher.getValue()); + std::unique_ptr<MatchExpression> root = std::move(statusWithMatcher.getValue()); MatchExpression::sortTree(root.get()); + if (root->matchType() == mongo::MatchExpression::NOT) { + // Ideally we would optimize() everything, but some of the tests depend on structural + // equivalence of single-arg $or expressions. + root = MatchExpression::optimize(std::move(root)); + } std::unique_ptr<MatchExpression> trueFilter(trueFilterNode->filter->shallowClone()); MatchExpression::sortTree(trueFilter.get()); if (trueFilter->equivalent(root.get())) { |