diff options
author | Brigitte Lamarche <thesisiwbl@gmail.com> | 2018-12-20 14:24:02 -0500 |
---|---|---|
committer | Brigitte Lamarche <thesisiwbl@gmail.com> | 2019-01-03 15:13:57 -0500 |
commit | bb9114dc71bfcf42422471f7789eca00881b8864 (patch) | |
tree | 4809839aab0c3f97bf56a66df15cd8eae8b03ca2 /src/mongo/db/pipeline/document_source_lookup.cpp | |
parent | 68832e1f70fa4571673ab337ae2e529b04b67e6b (diff) | |
download | mongo-bb9114dc71bfcf42422471f7789eca00881b8864.tar.gz |
SERVER-38362 Prevent $out stage within $lookup
Diffstat (limited to 'src/mongo/db/pipeline/document_source_lookup.cpp')
-rw-r--r-- | src/mongo/db/pipeline/document_source_lookup.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/db/pipeline/document_source_lookup.cpp b/src/mongo/db/pipeline/document_source_lookup.cpp index 84ff4c5496e..0d8ea164537 100644 --- a/src/mongo/db/pipeline/document_source_lookup.cpp +++ b/src/mongo/db/pipeline/document_source_lookup.cpp @@ -656,8 +656,14 @@ void DocumentSourceLookUp::initializeIntrospectionPipeline() { // 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", + "$changeStream is not allowed within a $lookup's pipeline", sources.empty() || !sources.front()->constraints().isChangeStreamStage()); + + // Ensure that the pipeline does not contain a $out stage. Since $out must be the last stage + // of a pipeline, we only need to check the last DocumentSource. + uassert(51047, + "$out is not allowed within a $lookup's pipeline", + sources.empty() || !sources.back()->constraints().writesPersistentData()); } void DocumentSourceLookUp::serializeToArray( |