summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/inclusion_projection_executor.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/exec/inclusion_projection_executor.h')
-rw-r--r--src/mongo/db/exec/inclusion_projection_executor.h41
1 files changed, 16 insertions, 25 deletions
diff --git a/src/mongo/db/exec/inclusion_projection_executor.h b/src/mongo/db/exec/inclusion_projection_executor.h
index 7f505f54797..a0429ff924f 100644
--- a/src/mongo/db/exec/inclusion_projection_executor.h
+++ b/src/mongo/db/exec/inclusion_projection_executor.h
@@ -133,9 +133,6 @@ protected:
Value transformSkippedValueForOutput(const Value& value) const final {
return Value();
}
- bool isIncluded() const final {
- return true;
- }
};
/**
@@ -173,24 +170,19 @@ private:
*/
class InclusionProjectionExecutor : public ProjectionExecutor {
public:
- InclusionProjectionExecutor(
- const boost::intrusive_ptr<ExpressionContext>& expCtx,
- ProjectionPolicies policies,
- std::unique_ptr<InclusionNode> root,
- boost::optional<projection_ast::ProjectionPathASTNode> proj = boost::none)
- : ProjectionExecutor(expCtx, policies, proj), _root(std::move(root)) {}
-
- InclusionProjectionExecutor(
- const boost::intrusive_ptr<ExpressionContext>& expCtx,
- ProjectionPolicies policies,
- bool allowFastPath = false,
- boost::optional<projection_ast::ProjectionPathASTNode> proj = boost::none)
+ InclusionProjectionExecutor(const boost::intrusive_ptr<ExpressionContext>& expCtx,
+ ProjectionPolicies policies,
+ std::unique_ptr<InclusionNode> root)
+ : ProjectionExecutor(expCtx, policies), _root(std::move(root)) {}
+
+ InclusionProjectionExecutor(const boost::intrusive_ptr<ExpressionContext>& expCtx,
+ ProjectionPolicies policies,
+ bool allowFastPath = false)
: InclusionProjectionExecutor(
expCtx,
policies,
allowFastPath ? std::make_unique<FastPathEligibleInclusionNode>(policies)
- : std::make_unique<InclusionNode>(policies),
- proj) {}
+ : std::make_unique<InclusionNode>(policies)) {}
TransformerType getType() const final {
return TransformerType::kInclusionProjection;
@@ -207,17 +199,16 @@ public:
/**
* Serialize the projection.
*/
- Document serializeTransformation(boost::optional<ExplainOptions::Verbosity> explain,
- const SerializationOptions& options = {}) const final {
+ Document serializeTransformation(
+ boost::optional<ExplainOptions::Verbosity> explain) const final {
MutableDocument output;
// The InclusionNode tree in '_root' will always have a top-level _id node if _id is to be
// included. If the _id node is not present, then explicitly set {_id: false} to avoid
// ambiguity in the expected behavior of the serialized projection.
- _root->serialize(explain, &output, options);
- auto idFieldName = options.serializeFieldPath("_id");
- if (output.peek()[idFieldName].missing()) {
- output.addField(idFieldName, Value{false});
+ _root->serialize(explain, &output);
+ if (output.peek()["_id"].missing()) {
+ output.addField("_id", Value{false});
}
return output.freeze();
@@ -246,10 +237,10 @@ public:
return {DocumentSource::GetModPathsReturn::Type::kAllPaths, {}, {}};
}
- OrderedPathSet preservedPaths;
+ std::set<std::string> preservedPaths;
_root->reportProjectedPaths(&preservedPaths);
- OrderedPathSet computedPaths;
+ std::set<std::string> computedPaths;
StringMap<std::string> renamedPaths;
_root->reportComputedPaths(&computedPaths, &renamedPaths);