-
Type: Task
-
Resolution: Won't Do
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
CommandCursor.batch_size is redundant. Users should pass "batchSize" to aggregate() instead. This code:
cursor = collection.aggregate([]).batch_size(100)
Can be changed to this:
cursor = collection.aggregate([], batchSize=100)
Another reason to remove CommandCursor.batch_size is that it lets users configure different batchSizes per getMore:
cursor = collection.aggregate([], batchSize=100) # next getMore will send batchSize=2 cursor.batch_size(2) ... # next getMore will send batchSize=5 cursor.batch_size(5)
Note that starting in PyMongo 3.6 (PYTHON-1338) the following calls are equivalent:
collection.aggregate([], batchSize=100).batch_size(100) collection.aggregate([], batchSize=100)
Before 3.6, the second example would only set the batchSize for the initial aggregate command and not for any subsequent getMores.
- depends on
-
PYTHON-2563 Deprecate CommandCursor.batch_size
- Closed
-
DRIVERS-1589 Allow changing BatchSize for getMores; needed when BatchSize(0) uses default size
- Backlog
- related to
-
PYTHON-1338 Change stream support
- Closed