diff options
author | Bernard Gorman <bernard.gorman@gmail.com> | 2018-09-21 04:12:00 +0100 |
---|---|---|
committer | Bernard Gorman <bernard.gorman@gmail.com> | 2018-09-22 01:09:31 +0100 |
commit | 10a0d12e9ea977660eb247143b09ecfdc51d05ea (patch) | |
tree | b7cacf5ae9fc8d81f1905cdf4969ce57fb167c1b /src/mongo/db/exec/projection_exec_agg_test.cpp | |
parent | a8995601144d16fe6c762624f64f5690b5caf684 (diff) | |
download | mongo-10a0d12e9ea977660eb247143b09ecfdc51d05ea.tar.gz |
SERVER-35493 Planning support for "field name or array index" path components in wildcard indexes
Diffstat (limited to 'src/mongo/db/exec/projection_exec_agg_test.cpp')
-rw-r--r-- | src/mongo/db/exec/projection_exec_agg_test.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/mongo/db/exec/projection_exec_agg_test.cpp b/src/mongo/db/exec/projection_exec_agg_test.cpp index 5105677f3f0..1aaa0668954 100644 --- a/src/mongo/db/exec/projection_exec_agg_test.cpp +++ b/src/mongo/db/exec/projection_exec_agg_test.cpp @@ -61,6 +61,15 @@ std::unique_ptr<ProjectionExecAgg> makeProjectionWithDefaultIdExclusionAndNested projSpec, DefaultIdPolicy::kExcludeId, ArrayRecursionPolicy::kRecurseNestedArrays); } +std::set<FieldRef> toFieldRefs(const std::set<std::string>& stringPaths) { + std::set<FieldRef> fieldRefs; + std::transform(stringPaths.begin(), + stringPaths.end(), + std::inserter(fieldRefs, fieldRefs.begin()), + [](const auto& path) { return FieldRef(path); }); + return fieldRefs; +} + // // Error cases. // @@ -190,7 +199,7 @@ TEST(ProjectionExecAggTests, InclusionFieldPathsWithImplicitIdInclusion) { // Extract the exhaustive set of paths that will be preserved by the projection. auto exhaustivePaths = parsedProject->getExhaustivePaths(); - std::set<std::string> expectedPaths{"_id", "a.b.c", "d"}; + std::set<FieldRef> expectedPaths = toFieldRefs({"_id", "a.b.c", "d"}); // Verify that the exhaustive set of paths is as expected. ASSERT(exhaustivePaths == expectedPaths); @@ -203,7 +212,7 @@ TEST(ProjectionExecAggTests, InclusionFieldPathsWithExplicitIdInclusion) { // Extract the exhaustive set of paths that will be preserved by the projection. auto exhaustivePaths = parsedProject->getExhaustivePaths(); - std::set<std::string> expectedPaths{"_id", "a.b.c", "d"}; + std::set<FieldRef> expectedPaths = toFieldRefs({"_id", "a.b.c", "d"}); // Verify that the exhaustive set of paths is as expected. ASSERT(exhaustivePaths == expectedPaths); @@ -216,7 +225,7 @@ TEST(ProjectionExecAggTests, InclusionFieldPathsWithExplicitIdInclusionIdOnly) { // Extract the exhaustive set of paths that will be preserved by the projection. auto exhaustivePaths = parsedProject->getExhaustivePaths(); - std::set<std::string> expectedPaths{"_id"}; + std::set<FieldRef> expectedPaths = toFieldRefs({"_id"}); // Verify that the exhaustive set of paths is as expected. ASSERT(exhaustivePaths == expectedPaths); @@ -229,7 +238,7 @@ TEST(ProjectionExecAggTests, InclusionFieldPathsWithImplicitIdExclusion) { // Extract the exhaustive set of paths that will be preserved by the projection. auto exhaustivePaths = parsedProject->getExhaustivePaths(); - std::set<std::string> expectedPaths{"a.b.c", "d"}; + std::set<FieldRef> expectedPaths = toFieldRefs({"a.b.c", "d"}); // Verify that the exhaustive set of paths is as expected. ASSERT(exhaustivePaths == expectedPaths); @@ -242,7 +251,7 @@ TEST(ProjectionExecAggTests, InclusionFieldPathsWithExplicitIdExclusion) { // Extract the exhaustive set of paths that will be preserved by the projection. auto exhaustivePaths = parsedProject->getExhaustivePaths(); - std::set<std::string> expectedPaths{"a.b.c", "d"}; + std::set<FieldRef> expectedPaths = toFieldRefs({"a.b.c", "d"}); // Verify that the exhaustive set of paths is as expected. ASSERT(exhaustivePaths == expectedPaths); |