diff --git a/src/mongo/db/exec/inclusion_projection_executor_test.cpp b/src/mongo/db/exec/inclusion_projection_executor_test.cpp
|
index a2d6932a87..582df1c610 100644
|
--- a/src/mongo/db/exec/inclusion_projection_executor_test.cpp
|
+++ b/src/mongo/db/exec/inclusion_projection_executor_test.cpp
|
@@ -405,7 +405,7 @@ TEST_F(InclusionProjectionExecutionTestWithFallBackToDefault,
|
ShouldReportThatAllExceptIncludedFieldsAreModifiedWithIdExclusion) {
|
auto inclusion = makeInclusionProjectionWithDefaultPolicies(
|
BSON("_id" << false << "a" << wrapInLiteral("computedVal") << "b.c"
|
- << wrapInLiteral("computedVal") << "d" << true << "e.f" << true));
|
+ << wrapInLiteral("computedVal") << "d" << true << "e.f" << true << "f" << "$f"));
|
|
auto modifiedPaths = inclusion->getModifiedPaths();
|
ASSERT(modifiedPaths.type == DocumentSource::GetModPathsReturn::Type::kAllExcept);
|
@@ -415,6 +415,7 @@ TEST_F(InclusionProjectionExecutionTestWithFallBackToDefault,
|
// Computed paths are modified.
|
ASSERT_EQ(modifiedPaths.paths.count("a"), 0UL);
|
ASSERT_EQ(modifiedPaths.paths.count("b.c"), 0UL);
|
+ ASSERT_EQ(modifiedPaths.paths.count("f"), 1UL);
|
// _id is explicitly excluded.
|
ASSERT_EQ(modifiedPaths.paths.count("_id"), 0UL);
|
|
diff --git a/src/mongo/db/exec/projection_node.cpp b/src/mongo/db/exec/projection_node.cpp
|
index 1ef569ecd7..3919f45188 100644
|
--- a/src/mongo/db/exec/projection_node.cpp
|
+++ b/src/mongo/db/exec/projection_node.cpp
|
@@ -250,6 +250,7 @@ void ProjectionNode::reportComputedPaths(std::set<std::string>* computedPaths,
|
|
for (auto&& rename : exprComputedPaths.renames) {
|
(*renamedPaths)[rename.first] = rename.second;
|
+ computedPaths->insert(rename.first);
|
}
|
}
|
for (auto&& childPair : _children) {
|
diff --git a/src/mongo/db/pipeline/document_source_add_fields_test.cpp b/src/mongo/db/pipeline/document_source_add_fields_test.cpp
|
index 9d3227f841..079f3715e2 100644
|
--- a/src/mongo/db/pipeline/document_source_add_fields_test.cpp
|
+++ b/src/mongo/db/pipeline/document_source_add_fields_test.cpp
|
@@ -271,7 +271,7 @@ TEST_F(AddFieldsTest, TestModifiedPaths) {
|
auto modifiedPaths = addFields->getModifiedPaths();
|
|
ASSERT(modifiedPaths.type == DocumentSource::GetModPathsReturn::Type::kFiniteSet);
|
- ASSERT_EQUALS(1U, modifiedPaths.paths.size());
|
+ ASSERT_EQUALS(2U, modifiedPaths.paths.size());
|
ASSERT_EQUALS(1U, modifiedPaths.renames.size());
|
}
|
} // namespace
|