diff options
author | Ian Boros <ian.boros@mongodb.com> | 2019-10-10 19:24:59 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-10 19:24:59 +0000 |
commit | cfcdc9b9b84c3d9afcbb804513bbdbd54b77b7db (patch) | |
tree | d2ebef38763cc0a9d079c1f28847a3d7be28bd6f /src/mongo/db/query/projection_test.cpp | |
parent | a5a158b4d78feabca56b27313c017160b9851cb7 (diff) | |
download | mongo-cfcdc9b9b84c3d9afcbb804513bbdbd54b77b7db.tar.gz |
SERVER-42560 Simplify passing of metadata between DocumentSource and PlanStage
Diffstat (limited to 'src/mongo/db/query/projection_test.cpp')
-rw-r--r-- | src/mongo/db/query/projection_test.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/mongo/db/query/projection_test.cpp b/src/mongo/db/query/projection_test.cpp index b11b00bd270..c0044173cd4 100644 --- a/src/mongo/db/query/projection_test.cpp +++ b/src/mongo/db/query/projection_test.cpp @@ -217,12 +217,12 @@ TEST(QueryProjectionTest, InvalidPositionalProjectionDefaultPathMatchExpression) TEST(QueryProjectionTest, ProjectionDefaults) { auto proj = createProjection("{}", "{}"); - ASSERT_FALSE(proj.wantSortKey()); + ASSERT_FALSE(proj.metadataDeps()[DocumentMetadataFields::kSortKey]); ASSERT_TRUE(proj.requiresDocument()); ASSERT_FALSE(proj.requiresMatchDetails()); - ASSERT_FALSE(proj.wantGeoNearDistance()); - ASSERT_FALSE(proj.wantGeoNearPoint()); - ASSERT_FALSE(proj.wantTextScore()); + ASSERT_FALSE(proj.metadataDeps()[DocumentMetadataFields::kGeoNearDist]); + ASSERT_FALSE(proj.metadataDeps()[DocumentMetadataFields::kGeoNearPoint]); + ASSERT_FALSE(proj.metadataDeps()[DocumentMetadataFields::kTextScore]); } TEST(QueryProjectionTest, SortKeyMetaProjectionInExclusionProjection) { @@ -230,11 +230,11 @@ TEST(QueryProjectionTest, SortKeyMetaProjectionInExclusionProjection) { auto proj = createProjection("{}", "{foo: {$meta: 'sortKey'}}"); ASSERT_BSONOBJ_EQ(proj.getProjObj(), fromjson("{foo: {$meta: 'sortKey'}}")); - ASSERT_TRUE(proj.wantSortKey()); + ASSERT_TRUE(proj.metadataDeps()[DocumentMetadataFields::kSortKey]); ASSERT_FALSE(proj.requiresMatchDetails()); - ASSERT_FALSE(proj.wantGeoNearDistance()); - ASSERT_FALSE(proj.wantGeoNearPoint()); + ASSERT_FALSE(proj.metadataDeps()[DocumentMetadataFields::kGeoNearDist]); + ASSERT_FALSE(proj.metadataDeps()[DocumentMetadataFields::kGeoNearPoint]); ASSERT_TRUE(proj.requiresDocument()); } @@ -242,11 +242,11 @@ TEST(QueryProjectionTest, SortKeyMetaProjectionInExclusionProjectionWithOtherFie auto proj = createProjection("{}", "{a: 0, foo: {$meta: 'sortKey'}}"); ASSERT_BSONOBJ_EQ(proj.getProjObj(), fromjson("{a: 0, foo: {$meta: 'sortKey'}}")); - ASSERT_TRUE(proj.wantSortKey()); + ASSERT_TRUE(proj.metadataDeps()[DocumentMetadataFields::kSortKey]); ASSERT_FALSE(proj.requiresMatchDetails()); - ASSERT_FALSE(proj.wantGeoNearDistance()); - ASSERT_FALSE(proj.wantGeoNearPoint()); + ASSERT_FALSE(proj.metadataDeps()[DocumentMetadataFields::kGeoNearDist]); + ASSERT_FALSE(proj.metadataDeps()[DocumentMetadataFields::kGeoNearPoint]); ASSERT_TRUE(proj.requiresDocument()); } @@ -254,11 +254,11 @@ TEST(QueryProjectionTest, SortKeyMetaProjectionInInclusionProjection) { auto proj = createProjection("{}", "{a: 1, foo: {$meta: 'sortKey'}}"); ASSERT_BSONOBJ_EQ(proj.getProjObj(), fromjson("{a: 1, foo: {$meta: 'sortKey'}}")); - ASSERT_TRUE(proj.wantSortKey()); + ASSERT_TRUE(proj.metadataDeps()[DocumentMetadataFields::kSortKey]); ASSERT_FALSE(proj.requiresMatchDetails()); - ASSERT_FALSE(proj.wantGeoNearDistance()); - ASSERT_FALSE(proj.wantGeoNearPoint()); + ASSERT_FALSE(proj.metadataDeps()[DocumentMetadataFields::kGeoNearDist]); + ASSERT_FALSE(proj.metadataDeps()[DocumentMetadataFields::kGeoNearPoint]); ASSERT_FALSE(proj.requiresDocument()); } @@ -266,12 +266,12 @@ TEST(QueryProjectionTest, SortKeyMetaProjectionDoesNotRequireDocument) { auto proj = createProjection("{}", "{a: 1, foo: {$meta: 'sortKey'}, _id: 0}"); ASSERT_BSONOBJ_EQ(proj.getProjObj(), fromjson("{a: 1, foo: {$meta: 'sortKey'}, _id: 0}")); - ASSERT_TRUE(proj.wantSortKey()); + ASSERT_TRUE(proj.metadataDeps()[DocumentMetadataFields::kSortKey]); ASSERT_FALSE(proj.requiresDocument()); ASSERT_FALSE(proj.requiresMatchDetails()); - ASSERT_FALSE(proj.wantGeoNearDistance()); - ASSERT_FALSE(proj.wantGeoNearPoint()); + ASSERT_FALSE(proj.metadataDeps()[DocumentMetadataFields::kGeoNearDist]); + ASSERT_FALSE(proj.metadataDeps()[DocumentMetadataFields::kGeoNearPoint]); } TEST(QueryProjectionTest, SortKeyMetaAndSlice) { @@ -279,12 +279,12 @@ TEST(QueryProjectionTest, SortKeyMetaAndSlice) { ASSERT_BSONOBJ_EQ(proj.getProjObj(), fromjson("{a: 1, foo: {$meta: 'sortKey'}, _id: 0, b: {$slice: 1}}")); - ASSERT_TRUE(proj.wantSortKey()); + ASSERT_TRUE(proj.metadataDeps()[DocumentMetadataFields::kSortKey]); ASSERT_TRUE(proj.requiresDocument()); ASSERT_FALSE(proj.requiresMatchDetails()); - ASSERT_FALSE(proj.wantGeoNearDistance()); - ASSERT_FALSE(proj.wantGeoNearPoint()); + ASSERT_FALSE(proj.metadataDeps()[DocumentMetadataFields::kGeoNearDist]); + ASSERT_FALSE(proj.metadataDeps()[DocumentMetadataFields::kGeoNearPoint]); } TEST(QueryProjectionTest, SortKeyMetaAndElemMatch) { @@ -293,12 +293,12 @@ TEST(QueryProjectionTest, SortKeyMetaAndElemMatch) { ASSERT_BSONOBJ_EQ(proj.getProjObj(), fromjson("{a: 1, foo: {$meta: 'sortKey'}, _id: 0, b: {$elemMatch: {a: 1}}}")); - ASSERT_TRUE(proj.wantSortKey()); + ASSERT_TRUE(proj.metadataDeps()[DocumentMetadataFields::kSortKey]); ASSERT_TRUE(proj.requiresDocument()); ASSERT_FALSE(proj.requiresMatchDetails()); - ASSERT_FALSE(proj.wantGeoNearDistance()); - ASSERT_FALSE(proj.wantGeoNearPoint()); + ASSERT_FALSE(proj.metadataDeps()[DocumentMetadataFields::kGeoNearDist]); + ASSERT_FALSE(proj.metadataDeps()[DocumentMetadataFields::kGeoNearPoint]); } // |