diff options
Diffstat (limited to 'src/mongo/db/query/query_planner_wildcard_index_test.cpp')
| -rw-r--r-- | src/mongo/db/query/query_planner_wildcard_index_test.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/mongo/db/query/query_planner_wildcard_index_test.cpp b/src/mongo/db/query/query_planner_wildcard_index_test.cpp index eca110ffac0..cd943126a17 100644 --- a/src/mongo/db/query/query_planner_wildcard_index_test.cpp +++ b/src/mongo/db/query/query_planner_wildcard_index_test.cpp @@ -56,7 +56,7 @@ protected: } void addWildcardIndex(BSONObj keyPattern, - const OrderedPathSet& multikeyPathSet = {}, + const std::set<std::string>& multikeyPathSet = {}, BSONObj wildcardProjection = BSONObj{}, MatchExpression* partialFilterExpr = nullptr, CollatorInterface* collator = nullptr, @@ -418,18 +418,25 @@ TEST_F(QueryPlannerWildcardTest, EqualityIndexScanOverNestedField) { "bounds: {'$_path': [['a.b','a.b',true,true]], 'a.b': [[5,5,true,true]]}}}}}"); } -TEST_F(QueryPlannerWildcardTest, ExprEqCannotUseIndex) { +TEST_F(QueryPlannerWildcardTest, ExprEqCanUseIndex) { addWildcardIndex(BSON("$**" << 1)); runQuery(fromjson("{a: {$_internalExprEq: 1}}")); - assertHasOnlyCollscan(); + assertNumSolutions(1U); + assertSolutionExists( + "{fetch: {filter: null, node: {ixscan: {pattern: {'$_path': 1, a: 1}," + "bounds: {'$_path': [['a','a',true,true]], a: [[1,1,true,true]]}}}}}"); } -TEST_F(QueryPlannerWildcardTest, ExprEqCannotUseSparseIndexForEqualityToNull) { +TEST_F(QueryPlannerWildcardTest, ExprEqCanUseSparseIndexForEqualityToNull) { addWildcardIndex(BSON("$**" << 1)); runQuery(fromjson("{a: {$_internalExprEq: null}}")); - assertHasOnlyCollscan(); + assertNumSolutions(1U); + assertSolutionExists( + "{fetch: {filter: {a: {$_internalExprEq: null}}, node: {ixscan: {pattern: {'$_path': 1, a: " + "1}, bounds: {'$_path': [['a','a',true,true]], a: [[undefined,undefined,true,true], " + "[null,null,true,true]]}}}}}"); } TEST_F(QueryPlannerWildcardTest, PrefixRegex) { |
