diff options
author | Ian Boros <ian.boros@mongodb.com> | 2019-10-10 19:24:59 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-10 19:24:59 +0000 |
commit | cfcdc9b9b84c3d9afcbb804513bbdbd54b77b7db (patch) | |
tree | d2ebef38763cc0a9d079c1f28847a3d7be28bd6f /src/mongo/db/commands/list_indexes.cpp | |
parent | a5a158b4d78feabca56b27313c017160b9851cb7 (diff) | |
download | mongo-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.cpp | 24 |
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); |