Skip to content

Commit 513b8a7

Browse files
committed
finally get the correct nToReturn value
if command: 1 if batch size: if limit: min(batch_size, limit) else: batch_size 0
1 parent 083498b commit 513b8a7

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/mongoc/mongoc-cursor.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,8 @@ _mongoc_n_return (mongoc_cursor_t * cursor)
8888
/* calculate remaining */
8989
uint32_t remaining = cursor->limit - cursor->count;
9090

91-
/* if we had a batch size */
92-
if (r) {
93-
/* use min of batch or remaining */
94-
r = MIN(r, (int32_t)remaining);
95-
} else {
96-
/* if we didn't, just use the remaining */
97-
r = remaining;
98-
}
91+
/* use min of batch or remaining */
92+
r = MIN(r, (int32_t)remaining);
9993
}
10094

10195
return r;

0 commit comments

Comments
 (0)