diff options
author | Mihai Andrei <mihai.andrei@mongodb.com> | 2020-01-29 15:13:38 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-02-19 22:44:37 +0000 |
commit | c54a777a4a154984f5595b11993d7d009350a38c (patch) | |
tree | b709682805f4ebc99aab698beeeefc83427668d9 /src/mongo/db/pipeline/document_source_merge.cpp | |
parent | d8810b45d790ebce228ff484dfc27494aadd2c6b (diff) | |
download | mongo-c54a777a4a154984f5595b11993d7d009350a38c.tar.gz |
SERVER-44689 Add serverStatus counter for each use of an aggregation stage in a user's request
Diffstat (limited to 'src/mongo/db/pipeline/document_source_merge.cpp')
-rw-r--r-- | src/mongo/db/pipeline/document_source_merge.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/mongo/db/pipeline/document_source_merge.cpp b/src/mongo/db/pipeline/document_source_merge.cpp index e953e813bc0..fbcb54950b8 100644 --- a/src/mongo/db/pipeline/document_source_merge.cpp +++ b/src/mongo/db/pipeline/document_source_merge.cpp @@ -329,19 +329,28 @@ std::unique_ptr<DocumentSourceMerge::LiteParsed> DocumentSourceMerge::LiteParsed MergeWhenMatchedMode_serializer(whenMatched), MergeWhenNotMatchedMode_serializer(whenNotMatched)), isSupportedMergeMode(whenMatched, whenNotMatched)); - - return std::make_unique<DocumentSourceMerge::LiteParsed>( - std::move(targetNss), whenMatched, whenNotMatched); + boost::optional<LiteParsedPipeline> liteParsedPipeline; + if (whenMatched == MergeWhenMatchedModeEnum::kPipeline) { + auto pipeline = mergeSpec.getWhenMatched()->pipeline; + invariant(pipeline); + liteParsedPipeline = LiteParsedPipeline(nss, *pipeline); + } + return std::make_unique<DocumentSourceMerge::LiteParsed>(spec.fieldName(), + std::move(targetNss), + whenMatched, + whenNotMatched, + std::move(liteParsedPipeline)); } PrivilegeVector DocumentSourceMerge::LiteParsed::requiredPrivileges( bool isMongos, bool bypassDocumentValidation) const { + invariant(_foreignNss); auto actions = ActionSet{getDescriptors().at({_whenMatched, _whenNotMatched}).actions}; if (bypassDocumentValidation) { actions.addAction(ActionType::bypassDocumentValidation); } - return {{ResourcePattern::forExactNamespace(_foreignNss), actions}}; + return {{ResourcePattern::forExactNamespace(*_foreignNss), actions}}; } DocumentSourceMerge::DocumentSourceMerge(NamespaceString outputNs, |