summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/plan_cache_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/query/plan_cache_test.cpp')
-rw-r--r--src/mongo/db/query/plan_cache_test.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mongo/db/query/plan_cache_test.cpp b/src/mongo/db/query/plan_cache_test.cpp
index b4d8f0f9ef0..fd77c971357 100644
--- a/src/mongo/db/query/plan_cache_test.cpp
+++ b/src/mongo/db/query/plan_cache_test.cpp
@@ -1277,6 +1277,21 @@ TEST_F(CachePlanSelectionTest, MatchingCollation) {
"{fetch: {node: {ixscan: {pattern: {x: 1}}}}}");
}
+TEST_F(CachePlanSelectionTest, ContainedOr) {
+ addIndex(BSON("b" << 1 << "a" << 1), "b_1_a_1");
+ addIndex(BSON("c" << 1 << "a" << 1), "c_1_a_1");
+ BSONObj query = fromjson("{$and: [{a: 5}, {$or: [{b: 6}, {c: 7}]}]}");
+ runQuery(query);
+ assertPlanCacheRecoversSolution(
+ query,
+ "{fetch: {filter: null, node: {or: {nodes: ["
+ "{ixscan: {pattern: {b: 1, a: 1}, bounds: {b: [[6, 6, true, true]], a: [[5, 5, true, "
+ "true]]}}},"
+ "{ixscan: {pattern: {c: 1, a: 1}, bounds: {c: [[7, 7, true, true]], a: [[5, 5, true, "
+ "true]]}}}"
+ "]}}}}");
+}
+
/**
* Test functions for computeKey. Cache keys are intentionally obfuscated and are
* meaningful only within the current lifetime of the server process. Users should treat plan