summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/list_indexes.cpp
diff options
context:
space:
mode:
authorIan Boros <ian.boros@mongodb.com>2019-10-10 19:24:59 +0000
committerevergreen <evergreen@mongodb.com>2019-10-10 19:24:59 +0000
commitcfcdc9b9b84c3d9afcbb804513bbdbd54b77b7db (patch)
treed2ebef38763cc0a9d079c1f28847a3d7be28bd6f /src/mongo/db/commands/list_indexes.cpp
parenta5a158b4d78feabca56b27313c017160b9851cb7 (diff)
downloadmongo-cfcdc9b9b84c3d9afcbb804513bbdbd54b77b7db.tar.gz
SERVER-42560 Simplify passing of metadata between DocumentSource and PlanStage
Diffstat (limited to 'src/mongo/db/commands/list_indexes.cpp')
-rw-r--r--src/mongo/db/commands/list_indexes.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/mongo/db/commands/list_indexes.cpp b/src/mongo/db/commands/list_indexes.cpp
index e830325e456..b7c26eb3309 100644
--- a/src/mongo/db/commands/list_indexes.cpp
+++ b/src/mongo/db/commands/list_indexes.cpp
@@ -199,13 +199,14 @@ public:
opCtx, std::move(ws), std::move(root), nullptr, PlanExecutor::NO_YIELD, nss));
for (long long objCount = 0; objCount < batchSize; objCount++) {
- BSONObj next;
- PlanExecutor::ExecState state = exec->getNext(&next, nullptr);
+ Document nextDoc;
+ PlanExecutor::ExecState state = exec->getNext(&nextDoc, nullptr);
if (state == PlanExecutor::IS_EOF) {
break;
}
invariant(state == PlanExecutor::ADVANCED);
+ BSONObj next = nextDoc.toBson();
// If we can't fit this result inside the current batch, then we stash it for later.
if (!FindCommon::haveSpaceForNext(next, objCount, firstBatch.len())) {
exec->enqueue(next);
@@ -227,14 +228,17 @@ public:
const auto pinnedCursor = CursorManager::get(opCtx)->registerCursor(
opCtx,
- {std::move(exec),
- nss,
- AuthorizationSession::get(opCtx->getClient())->getAuthenticatedUserNames(),
- opCtx->getWriteConcern(),
- repl::ReadConcernArgs::get(opCtx),
- cmdObj,
- ClientCursorParams::LockPolicy::kLocksInternally,
- {Privilege(ResourcePattern::forExactNamespace(nss), ActionType::listIndexes)}});
+ {
+ std::move(exec),
+ nss,
+ AuthorizationSession::get(opCtx->getClient())->getAuthenticatedUserNames(),
+ opCtx->getWriteConcern(),
+ repl::ReadConcernArgs::get(opCtx),
+ cmdObj,
+ ClientCursorParams::LockPolicy::kLocksInternally,
+ {Privilege(ResourcePattern::forExactNamespace(nss), ActionType::listIndexes)},
+ false // needsMerge always 'false' for listIndexes.
+ });
appendCursorResponseObject(
pinnedCursor.getCursor()->cursorid(), nss.ns(), firstBatch.arr(), &result);