summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/find.cpp
diff options
context:
space:
mode:
authorDavid Storch <david.storch@mongodb.com>2020-06-24 18:38:08 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-07-09 14:14:43 +0000
commita58d7ea75368b103a7f493c0ff6035b9a099b88d (patch)
tree971c74fde502d5549d46b5e63bcc7b854fb78f32 /src/mongo/db/query/find.cpp
parentc37aaac0696c3b4a69df191bd991e474824e43b1 (diff)
downloadmongo-a58d7ea75368b103a7f493c0ff6035b9a099b88d.tar.gz
SERVER-48477 Make PlanExecutor interface more generic
After this change, the interface is sensible for both the classic and SBE engines (with the exception of 'getRootStage()' which is left as future work).
Diffstat (limited to 'src/mongo/db/query/find.cpp')
-rw-r--r--src/mongo/db/query/find.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp
index 49169ef4ddc..c936ea37681 100644
--- a/src/mongo/db/query/find.cpp
+++ b/src/mongo/db/query/find.cpp
@@ -165,10 +165,9 @@ void generateBatch(int ntoreturn,
PlanExecutor* exec = cursor->getExecutor();
try {
- Document doc;
+ BSONObj obj;
while (!FindCommon::enoughForGetMore(ntoreturn, *numResults) &&
- PlanExecutor::ADVANCED == (*state = exec->getNext(&doc, nullptr))) {
- BSONObj obj = doc.toBson();
+ PlanExecutor::ADVANCED == (*state = exec->getNext(&obj, nullptr))) {
// If we can't fit this result inside the current batch, then we stash it for later.
if (!FindCommon::haveSpaceForNext(obj, *numResults, bb->len())) {
@@ -697,10 +696,7 @@ bool runQuery(OperationContext* opCtx,
}
try {
- Document doc;
- while (PlanExecutor::ADVANCED == (state = exec->getNext(&doc, nullptr))) {
- obj = doc.toBson();
-
+ while (PlanExecutor::ADVANCED == (state = exec->getNext(&obj, nullptr))) {
// If we can't fit this result inside the current batch, then we stash it for later.
if (!FindCommon::haveSpaceForNext(obj, numResults, bb.len())) {
exec->enqueue(obj);
@@ -749,16 +745,13 @@ bool runQuery(OperationContext* opCtx,
// Allocate a new ClientCursor and register it with the cursor manager.
ClientCursorPin pinnedCursor = CursorManager::get(opCtx)->registerCursor(
opCtx,
- {
- std::move(exec),
- nss,
- AuthorizationSession::get(opCtx->getClient())->getAuthenticatedUserNames(),
- opCtx->getWriteConcern(),
- readConcernArgs,
- upconvertedQuery,
- {Privilege(ResourcePattern::forExactNamespace(nss), ActionType::find)},
- false // needsMerge always 'false' for find().
- });
+ {std::move(exec),
+ nss,
+ AuthorizationSession::get(opCtx->getClient())->getAuthenticatedUserNames(),
+ opCtx->getWriteConcern(),
+ readConcernArgs,
+ upconvertedQuery,
+ {Privilege(ResourcePattern::forExactNamespace(nss), ActionType::find)}});
ccId = pinnedCursor.getCursor()->cursorid();
LOGV2_DEBUG(