Skip to content

Commit 973f199

Browse files
author
Alberto Lerner
committed
SERVER-10545 Don't save tailable cursor if only one document was requested.
1 parent b92263d commit 973f199

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/mongo/db/query/new_find.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ namespace mongo {
696696
// collection is empty. Otherwise, the semantics of the tailable cursor is that the
697697
// client will keep trying to read from it. So we'll keep it around.
698698
Collection* collection = ctx.ctx().db()->getCollection(cq->ns());
699-
if (collection->numRecords() != 0) {
699+
if (collection->numRecords() != 0 && pq.getNumToReturn() != 1) {
700700
saveClientCursor = true;
701701
}
702702
}

0 commit comments

Comments
 (0)