CommandCursor class to iterate over command results.
Create a new command cursor.
The (host, port) of the server used, or None.
New in version 3.0.
Does this cursor have the potential to return more data?
Even if alive is True, next() can raise StopIteration. Best to use a for loop:
for doc in collection.aggregate(pipeline):
print(doc)
Limits the number of documents returned in one batch. Each batch requires a round trip to the server. It can be adjusted to optimize performance and limit data transfer.
Note
batch_size can not override MongoDB’s internal limits on the amount of data it will return to the client in a single batch (i.e if you set batch size to 1,000,000,000, MongoDB will currently only return 4-16MB of results per batch).
Raises TypeError if batch_size is not an integer. Raises ValueError if batch_size is less than 0.
Parameters : |
|
---|
Explicitly close / kill this cursor. Required for PyPy, Jython and other Python implementations that don’t use reference counting garbage collection.
Returns the id of the cursor.
Advance the cursor.