summaryrefslogtreecommitdiff
path: root/src/mongo/db/bson/dotted_path_support_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/bson/dotted_path_support_test.cpp')
-rw-r--r--src/mongo/db/bson/dotted_path_support_test.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mongo/db/bson/dotted_path_support_test.cpp b/src/mongo/db/bson/dotted_path_support_test.cpp
index facdf459860..28a2a15f433 100644
--- a/src/mongo/db/bson/dotted_path_support_test.cpp
+++ b/src/mongo/db/bson/dotted_path_support_test.cpp
@@ -626,5 +626,19 @@ TEST(ExtractElementAtPathOrArrayAlongPath, NumericalPathElementTreatedAsFieldNam
ASSERT(StringData(pathData).empty());
}
+TEST(ExtractElementAtPathOrArrayAlongPath, FieldWithDotsDontHideNestedObjects) {
+ BSONObj obj(fromjson("{b: {c: 'foo'}, \"b.c\": 'bar'}"));
+ BSONElementSet actualElements;
+ const bool expandArrayOnTrailingField = true;
+ MultikeyComponents actualArrayComponents;
+ dps::extractAllElementsAlongPath(
+ obj, "b.c", actualElements, expandArrayOnTrailingField, &actualArrayComponents);
+
+ assertBSONElementSetsAreEqual({BSON("c"
+ << "foo")},
+ actualElements);
+ assertArrayComponentsAreEqual(MultikeyComponents{}, actualArrayComponents);
+}
+
} // namespace
} // namespace mongo