summaryrefslogtreecommitdiff
path: root/src/mongo/db/query
diff options
context:
space:
mode:
authorCharlie Swanson <charlie.swanson@mongodb.com>2016-09-28 16:20:30 -0400
committerCharlie Swanson <charlie.swanson@mongodb.com>2016-09-28 16:20:30 -0400
commit9c8d1cf08ed9b0eeae08b490df67026af40982cd (patch)
treef59d7a436e4924f7837c98bf414f8f17d846944a /src/mongo/db/query
parent998343374c0351bc7b903ea704c1ac7bbdd12c46 (diff)
downloadmongo-9c8d1cf08ed9b0eeae08b490df67026af40982cd.tar.gz
SERVER-26334 fix mongos handling of ntoreturn:1
Diffstat (limited to 'src/mongo/db/query')
-rw-r--r--src/mongo/db/query/find.cpp6
-rw-r--r--src/mongo/db/query/query_request.cpp5
2 files changed, 6 insertions, 5 deletions
diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp
index 14645bd55e1..bbce97fc50b 100644
--- a/src/mongo/db/query/find.cpp
+++ b/src/mongo/db/query/find.cpp
@@ -89,11 +89,7 @@ bool shouldSaveCursor(OperationContext* txn,
}
const QueryRequest& qr = exec->getCanonicalQuery()->getQueryRequest();
- if (!qr.wantMore() && !qr.isTailable()) {
- return false;
- }
-
- if (qr.getNToReturn().value_or(0) == 1) {
+ if (!qr.wantMore()) {
return false;
}
diff --git a/src/mongo/db/query/query_request.cpp b/src/mongo/db/query/query_request.cpp
index b0aa759e853..af2c46b550c 100644
--- a/src/mongo/db/query/query_request.cpp
+++ b/src/mongo/db/query/query_request.cpp
@@ -734,6 +734,11 @@ Status QueryRequest::init(int ntoskip,
}
}
+ // An ntoreturn of 1 is special because it also means to return at most one batch.
+ if (_ntoreturn.value_or(0) == 1) {
+ _wantMore = false;
+ }
+
// Initialize flags passed as 'queryOptions' bit vector.
initFromInt(queryOptions);