Details
-
Bug
-
Status: Closed
-
Minor - P4
-
Resolution: Fixed
-
2.0.1
-
None
-
None
-
Any
-
Fully Compatible
Description
Unless a limit is set on a query, pymongo passes 0 as numToReturn (see http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol#MongoWireProtocol-OPQUERY), even if a batch size is set. This means the first results from a query are the lesser of 101 documents or 1 megabyte of data (see https://github.com/mongodb/mongo/blob/master/db/ops/query.h#L122)
Desired logic is:
if both batch_size and limit are set, set numToReturn = min(batch_size, limit)
if either but not both are set, set numToReturn to that value
else set numToReturn to 0