summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_single_document_transformation.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/document_source_single_document_transformation.h')
-rw-r--r--src/mongo/db/pipeline/document_source_single_document_transformation.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/document_source_single_document_transformation.h b/src/mongo/db/pipeline/document_source_single_document_transformation.h
index 158f9936fdc..8c7369e396d 100644
--- a/src/mongo/db/pipeline/document_source_single_document_transformation.h
+++ b/src/mongo/db/pipeline/document_source_single_document_transformation.h
@@ -117,6 +117,17 @@ public:
return _parsedTransform->extractComputedProjections(oldName, newName, reservedNames);
}
+ /**
+ * If this transformation is a project, removes and returns a BSONObj representing the part of
+ * this project that depends only on 'oldName'. Also returns a bool indicating whether this
+ * entire project is extracted. In the extracted $project, 'oldName' is renamed to 'newName'.
+ * 'oldName' should not be dotted.
+ */
+ std::pair<BSONObj, bool> extractProjectOnFieldAndRename(const StringData& oldName,
+ const StringData& newName) {
+ return _parsedTransform->extractProjectOnFieldAndRename(oldName, newName);
+ }
+
protected:
GetNextResult doGetNext() final;
void doDispose() final;