summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/plan_executor_impl.cpp
diff options
context:
space:
mode:
authorMihai Andrei <mihai.andrei@10gen.com>2020-07-21 15:49:39 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-07-24 20:31:10 +0000
commit2e02a4afe323396e15073a38244889862353836c (patch)
treed1b2012be26759e17cae5d15a934e0a78d4bf66d /src/mongo/db/query/plan_executor_impl.cpp
parentb9515a079627f792c910c8ed2bb683cc9b071ebd (diff)
downloadmongo-2e02a4afe323396e15073a38244889862353836c.tar.gz
SERVER-49784 PlanExecutorImpl::getNext should only modify 'objOut' if getNextDocument returns ADVANCED
Diffstat (limited to 'src/mongo/db/query/plan_executor_impl.cpp')
-rw-r--r--src/mongo/db/query/plan_executor_impl.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mongo/db/query/plan_executor_impl.cpp b/src/mongo/db/query/plan_executor_impl.cpp
index cc3923a7990..8b0126ed50b 100644
--- a/src/mongo/db/query/plan_executor_impl.cpp
+++ b/src/mongo/db/query/plan_executor_impl.cpp
@@ -305,7 +305,7 @@ void PlanExecutorImpl::reattachToOperationContext(OperationContext* opCtx) {
PlanExecutor::ExecState PlanExecutorImpl::getNext(BSONObj* objOut, RecordId* dlOut) {
const auto state = getNextDocument(&_docOutput, dlOut);
- if (objOut) {
+ if (objOut && state == ExecState::ADVANCED) {
const bool includeMetadata = _expCtx && _expCtx->needsMerge;
*objOut = includeMetadata ? _docOutput.toBsonWithMetaData() : _docOutput.toBson();
}