summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/plan_executor_pipeline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/plan_executor_pipeline.cpp')
-rw-r--r--src/mongo/db/pipeline/plan_executor_pipeline.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mongo/db/pipeline/plan_executor_pipeline.cpp b/src/mongo/db/pipeline/plan_executor_pipeline.cpp
index 2b1d70b5681..e557f071b8a 100644
--- a/src/mongo/db/pipeline/plan_executor_pipeline.cpp
+++ b/src/mongo/db/pipeline/plan_executor_pipeline.cpp
@@ -79,7 +79,8 @@ PlanExecutor::ExecState PlanExecutorPipeline::getNext(BSONObj* objOut, RecordId*
auto execState = getNextDocument(&docOut, nullptr);
if (execState == PlanExecutor::ADVANCED) {
// Include metadata if the output will be consumed by a merging node.
- *objOut = _expCtx->needsMerge ? docOut.toBsonWithMetaData() : docOut.toBson();
+ *objOut = _expCtx->needsMerge || _expCtx->forPerShardCursor ? docOut.toBsonWithMetaData()
+ : docOut.toBson();
}
return execState;
}