command_cursor
– Tools for iterating over MongoDB command results
class pymongo.command_cursor.CommandCursor
(collection, cursor_info, address, retrieved=0, batch_size=0, max_await_time_ms=None, session=None, explicit_session=False)
Create a new command cursor.
The parameter ‘retrieved’ is unused.
address
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
, can raise StopIteration. Best to use a for loop:can be True while iterating a cursor from a failed server. In this case alive will return False after fails to retrieve the next batch of results from the server.
()
Explicitly close / kill this cursor.
next
()Advance the cursor.
session
The cursor’s ClientSession, or None.
New in version 3.6.
class (collection, cursor_info, address, retrieved=0, batch_size=0, max_await_time_ms=None, session=None, explicit_session=False)
Create a new cursor / iterator over raw batches of BSON data.
Should not be called directly by application developers - see instead.
See also