diff options
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( |