diff options
Diffstat (limited to 'src/mongo/db/pipeline/expression_context.cpp')
-rw-r--r-- | src/mongo/db/pipeline/expression_context.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/db/pipeline/expression_context.cpp b/src/mongo/db/pipeline/expression_context.cpp index 9f65c12669f..781c0cc96c1 100644 --- a/src/mongo/db/pipeline/expression_context.cpp +++ b/src/mongo/db/pipeline/expression_context.cpp @@ -67,6 +67,10 @@ ExpressionContext::ExpressionContext(OperationContext* opCtx, } else { variables.setDefaultRuntimeConstants(opCtx); } + + // Any request which did not originate from a mongoS, or which did originate from a mongoS but + // has the 'useNewUpsert' flag set, can use the new upsertSupplied mechanism for $merge. + useNewUpsert = request.getUseNewUpsert() || !request.isFromMongos(); } ExpressionContext::ExpressionContext(OperationContext* opCtx, @@ -164,6 +168,7 @@ intrusive_ptr<ExpressionContext> ExpressionContext::copyWith( expCtx->subPipelineDepth = subPipelineDepth; expCtx->tempDir = tempDir; + expCtx->useNewUpsert = useNewUpsert; expCtx->opCtx = opCtx; |