summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/parsed_inclusion_projection.h
diff options
context:
space:
mode:
authorDavid Storch <david.storch@10gen.com>2016-10-03 11:48:27 -0400
committerDavid Storch <david.storch@10gen.com>2016-10-06 11:19:24 -0400
commit4976eb401b3f16482fb35287ea60d7e8b33fe76d (patch)
tree3ab5cfaec3f76dc334b006f0b1eeb7162772d4d6 /src/mongo/db/pipeline/parsed_inclusion_projection.h
parenta2d34afd4330258e05c5ac1e9174338cfda29a10 (diff)
downloadmongo-4976eb401b3f16482fb35287ea60d7e8b33fe76d.tar.gz
SERVER-19153 push $match as far forward as possible
Diffstat (limited to 'src/mongo/db/pipeline/parsed_inclusion_projection.h')
-rw-r--r--src/mongo/db/pipeline/parsed_inclusion_projection.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/parsed_inclusion_projection.h b/src/mongo/db/pipeline/parsed_inclusion_projection.h
index eb2bc1877bc..8cd04514b53 100644
--- a/src/mongo/db/pipeline/parsed_inclusion_projection.h
+++ b/src/mongo/db/pipeline/parsed_inclusion_projection.h
@@ -121,6 +121,11 @@ public:
void injectExpressionContext(const boost::intrusive_ptr<ExpressionContext>& expCtx);
+ /**
+ * Recursively add all paths that are preserved by this inclusion projection.
+ */
+ void addPreservedPaths(std::set<std::string>* preservedPaths) const;
+
private:
// Helpers for the Document versions above. These will apply the transformation recursively to
// each element of any arrays, and ensure non-documents are handled appropriately.
@@ -214,6 +219,12 @@ public:
return DocumentSource::EXHAUSTIVE_FIELDS;
}
+ DocumentSource::GetModPathsReturn getModifiedPaths() const final {
+ std::set<std::string> preservedPaths;
+ _root->addPreservedPaths(&preservedPaths);
+ return {DocumentSource::GetModPathsReturn::Type::kAllExcept, std::move(preservedPaths)};
+ }
+
/**
* Apply this exclusion projection to 'inputDoc'.
*