STR:
The client should be connecting to a mongo instance such that
top.SelectServer.Description.WireVersion.Max < 4
Create and execute a query that specifies limit.
Observe that a multiple of batchSize documents are returned, not the value of limit.
* if limit < batchSize, batchSize is returned
* if limit >= batchSize, n * batchSize is returned
Notes:
After a lengthy debugging session, we discovered the following. Hopefully it will guide you to a solution.
- BatchCursor.Next() calls legacyGetMore, which appends batchSize documents to currentBatch.Data
- If limit < batchSize, numToReturn is a negative number. This may or may not be causing problems. Hard for us to tell as outsiders. This should probably be a short circuit condition
- An extra network request is made. This causes more documents to be added to bc.currentBatch.Data. Limit is not being honored, as there is no logic similar to NewLegacyBatchCursor #118-#126 in legacyGetMore.
- backported by
-
GODRIVER-965 Backports "Legacy Find is not respecting limit"
- Closed