summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorNicholas Zolnierz <nicholas.zolnierz@mongodb.com>2020-02-13 15:09:48 +0000
committerevergreen <evergreen@mongodb.com>2020-02-13 15:09:48 +0000
commite87edace22b258809b6f209a3cdc6c123149a16b (patch)
tree4a189176dce4ffc5c0a2718325e8b5c030e464a6 /src/mongo
parente289b78c61033674f6440d9ddc402b50903717ac (diff)
downloadmongo-e87edace22b258809b6f209a3cdc6c123149a16b.tar.gz
SERVER-46087 Propagate allowDiskUse to shards for sharded $unionWith
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/pipeline/sharded_agg_helpers.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mongo/db/pipeline/sharded_agg_helpers.cpp b/src/mongo/db/pipeline/sharded_agg_helpers.cpp
index fabc49ceb4e..d6d3569e5a8 100644
--- a/src/mongo/db/pipeline/sharded_agg_helpers.cpp
+++ b/src/mongo/db/pipeline/sharded_agg_helpers.cpp
@@ -128,7 +128,7 @@ BSONObj genericTransformForShards(MutableDocument&& cmdForShards,
cmdForShards[AggregationRequest::kRuntimeConstants] = Value(constants.get().toBSON());
}
- cmdForShards[AggregationRequest::kFromMongosName] = Value(true);
+ cmdForShards[AggregationRequest::kFromMongosName] = Value(expCtx->inMongos);
// If this is a request for an aggregation explain, then we must wrap the aggregate inside an
// explain command.
if (explainVerbosity) {
@@ -955,6 +955,11 @@ std::unique_ptr<Pipeline, PipelineDeleter> targetShardsAndAddMergeCursors(
}();
AggregationRequest aggRequest(expCtx->ns, rawStages);
+
+ // The default value for 'allowDiskUse' in the AggregationRequest may not match what was set
+ // on the originating command, so copy it from the ExpressionContext.
+ aggRequest.setAllowDiskUse(expCtx->allowDiskUse);
+
LiteParsedPipeline liteParsedPipeline(aggRequest);
auto hasChangeStream = liteParsedPipeline.hasChangeStream();
auto shardDispatchResults = dispatchShardPipeline(