summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorMax Hirschhorn <max.hirschhorn@mongodb.com>2016-04-18 10:33:22 -0400
committerMax Hirschhorn <max.hirschhorn@mongodb.com>2016-04-18 10:33:22 -0400
commitd17e4a60f6970defb7d4993e1a85bf74fa30d553 (patch)
tree79fa7a6ba6d7d6f984955b0725fc413a5498e3e9 /src/mongo
parentada93b91fee623a25dbf050b744269e4ccee8cba (diff)
downloadmongo-d17e4a60f6970defb7d4993e1a85bf74fa30d553.tar.gz
SERVER-23628 Verify field names of index bounds in QueryPlannerTest.
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/query/query_planner_array_test.cpp2
-rw-r--r--src/mongo/db/query/query_planner_collation_test.cpp2
-rw-r--r--src/mongo/db/query/query_planner_test_lib.cpp3
3 files changed, 5 insertions, 2 deletions
diff --git a/src/mongo/db/query/query_planner_array_test.cpp b/src/mongo/db/query/query_planner_array_test.cpp
index 6ff77e845f7..d5f7fa741a3 100644
--- a/src/mongo/db/query/query_planner_array_test.cpp
+++ b/src/mongo/db/query/query_planner_array_test.cpp
@@ -1398,7 +1398,7 @@ TEST_F(QueryPlannerTest, CanCompoundBoundsWhenSharedPrefixIsMultikeyButHasElemMa
assertSolutionExists("{cscan: {dir: 1, filter: {a: {$elemMatch: {b: 2, c: 3}}}}}");
assertSolutionExists(
"{fetch: {node: {ixscan: {pattern: {'a.b': 1, 'a.c': 1}, "
- "bounds: {a: [[2, 2, true, true]], b: [[3, 3, true, true]]}}}}}");
+ "bounds: {'a.b': [[2, 2, true, true]], 'a.c': [[3, 3, true, true]]}}}}}");
}
TEST_F(QueryPlannerTest, CannotCompoundBoundsWhenSharedPrefixInsideElemMatchIsMultikey) {
diff --git a/src/mongo/db/query/query_planner_collation_test.cpp b/src/mongo/db/query/query_planner_collation_test.cpp
index 96df025483f..d2ba23b8488 100644
--- a/src/mongo/db/query/query_planner_collation_test.cpp
+++ b/src/mongo/db/query/query_planner_collation_test.cpp
@@ -207,7 +207,7 @@ TEST_F(QueryPlannerTest, OrQueryCanBeIndexedWhenBothBranchesHaveIndexWithMatchin
assertSolutionExists(
"{or: {nodes: ["
"{fetch: {node: {ixscan: {pattern: {a: 1}, bounds: {a: [['oof','oof',true,true]]}}}}},"
- "{fetch: {node: {ixscan: {pattern: {b: 1}, bounds: {a: [['rab','rab',true,true]]}}}}}]}}");
+ "{fetch: {node: {ixscan: {pattern: {b: 1}, bounds: {b: [['rab','rab',true,true]]}}}}}]}}");
}
TEST_F(QueryPlannerTest, ElemMatchObjectResultsInCorrectComparisonKeyBounds) {
diff --git a/src/mongo/db/query/query_planner_test_lib.cpp b/src/mongo/db/query/query_planner_test_lib.cpp
index 2ba02902729..c0bdb8e5d3a 100644
--- a/src/mongo/db/query/query_planner_test_lib.cpp
+++ b/src/mongo/db/query/query_planner_test_lib.cpp
@@ -130,6 +130,9 @@ bool boundsMatch(const BSONObj& testBounds, const IndexBounds trueBounds) {
int fieldItCount = 0;
while (fieldIt.more()) {
BSONElement arrEl = fieldIt.next();
+ if (arrEl.fieldNameStringData() != trueBounds.getFieldName(fieldItCount)) {
+ return false;
+ }
if (arrEl.type() != Array) {
return false;
}