summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_lookup.cpp
diff options
context:
space:
mode:
authorBernard Gorman <bernard.gorman@gmail.com>2017-10-06 06:29:33 +0100
committerBernard Gorman <bernard.gorman@gmail.com>2017-10-10 15:11:13 +0100
commit125fa84f4a6ee5faabae5529d6a6c05816c7050b (patch)
tree30ba3ed233fd9c3cdaeec4c076d1c8b359832600 /src/mongo/db/pipeline/document_source_lookup.cpp
parent1e2626463b5a7c22484c4556b77da149f4ad1ef9 (diff)
downloadmongo-125fa84f4a6ee5faabae5529d6a6c05816c7050b.tar.gz
SERVER-31416 Ban $changeStream from $lookup pipelines
Diffstat (limited to 'src/mongo/db/pipeline/document_source_lookup.cpp')
-rw-r--r--src/mongo/db/pipeline/document_source_lookup.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/document_source_lookup.cpp b/src/mongo/db/pipeline/document_source_lookup.cpp
index 7e77efe2d80..c7c8873e22b 100644
--- a/src/mongo/db/pipeline/document_source_lookup.cpp
+++ b/src/mongo/db/pipeline/document_source_lookup.cpp
@@ -596,6 +596,19 @@ void DocumentSourceLookUp::resolveLetVariables(const Document& localDoc, Variabl
}
}
+void DocumentSourceLookUp::initializeIntrospectionPipeline() {
+ copyVariablesToExpCtx(_variables, _variablesParseState, _fromExpCtx.get());
+ _parsedIntrospectionPipeline = uassertStatusOK(Pipeline::parse(_resolvedPipeline, _fromExpCtx));
+
+ auto& sources = _parsedIntrospectionPipeline->getSources();
+
+ // Ensure that the pipeline does not contain a $changeStream stage. This check will be
+ // performed recursively on all sub-pipelines.
+ uassert(ErrorCodes::IllegalOperation,
+ "$changeStream is not allowed within a $lookup foreign pipeline",
+ sources.empty() || !sources.front()->constraints().isChangeStreamStage());
+}
+
void DocumentSourceLookUp::serializeToArray(
std::vector<Value>& array, boost::optional<ExplainOptions::Verbosity> explain) const {
Document doc;