diff options
author | Sally McNichols <sally.mcnichols@mongodb.com> | 2016-08-04 16:37:32 -0400 |
---|---|---|
committer | Sally McNichols <sally.mcnichols@mongodb.com> | 2016-08-04 16:37:32 -0400 |
commit | 1f291f5be44a18bd578b9a2402715531ed5d0a67 (patch) | |
tree | 5c02a5d880a949f2e57600c8a618c5a07e660778 /src/mongo/db/pipeline/parsed_exclusion_projection_test.cpp | |
parent | 215d900368abcb5ea05daeadb889cd380122d312 (diff) | |
download | mongo-1f291f5be44a18bd578b9a2402715531ed5d0a67.tar.gz |
SERVER-24921 allow excluding only the _id field in $project
Diffstat (limited to 'src/mongo/db/pipeline/parsed_exclusion_projection_test.cpp')
-rw-r--r-- | src/mongo/db/pipeline/parsed_exclusion_projection_test.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/parsed_exclusion_projection_test.cpp b/src/mongo/db/pipeline/parsed_exclusion_projection_test.cpp index 5768b46882a..a9fb218d8ef 100644 --- a/src/mongo/db/pipeline/parsed_exclusion_projection_test.cpp +++ b/src/mongo/db/pipeline/parsed_exclusion_projection_test.cpp @@ -180,6 +180,14 @@ TEST(ExclusionProjectionExecutionTest, ShouldExcludeIdIfExplicitlyExcluded) { ASSERT_DOCUMENT_EQ(result, expectedResult); } +TEST(ExclusionProjectionExecutionTest, ShouldExcludeIdAndKeepAllOtherFields) { + ParsedExclusionProjection exclusion; + exclusion.parse(BSON("_id" << false)); + auto result = exclusion.applyProjection(Document{{"a", 1}, {"b", 2}, {"_id", "ID"}}); + auto expectedResult = Document{{"a", 1}, {"b", 2}}; + ASSERT_DOCUMENT_EQ(result, expectedResult); +} + // // Tests of execution of nested exclusions. // |