|
OpenQuizz
Une application de gestion des contenus pédagogiques
|


Public Member Functions | |
| def | __init__ (self, collection, cursor_info, address, retrieved=0, batch_size=0, max_await_time_ms=None, session=None, explicit_session=False) |
| def | __del__ (self) |
| def | close (self) |
| def | batch_size (self, batch_size) |
| def | alive (self) |
| def | cursor_id (self) |
| def | address (self) |
| def | session (self) |
| def | __iter__ (self) |
| def | next (self) |
| def | __enter__ (self) |
| def | __exit__ (self, exc_type, exc_val, exc_tb) |
A cursor / iterator over command cursors.
| def __init__ | ( | self, | |
| 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.
Reimplemented in RawBatchCommandCursor.
| def __del__ | ( | self | ) |
| def __enter__ | ( | self | ) |
| def __exit__ | ( | self, | |
| exc_type, | |||
| exc_val, | |||
| exc_tb | |||
| ) |
| def __iter__ | ( | self | ) |
| def address | ( | self | ) |
The (host, port) of the server used, or None. .. versionadded:: 3.0
| def alive | ( | self | ) |
Does this cursor have the potential to return more data?
Even if :attr:`alive` is ``True``, :meth:`next` can raise
:exc:`StopIteration`. Best to use a for loop::
for doc in collection.aggregate(pipeline):
print(doc)
.. note:: :attr:`alive` can be True while iterating a cursor from
a failed server. In this case :attr:`alive` will return False after
:meth:`next` fails to retrieve the next batch of results from the
server.
| def batch_size | ( | self, | |
| batch_size | |||
| ) |
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 :exc:`TypeError` if `batch_size` is not an integer. Raises :exc:`ValueError` if `batch_size` is less than ``0``. :Parameters: - `batch_size`: The size of each batch of results requested.
| def close | ( | self | ) |
Explicitly close / kill this cursor.
| def cursor_id | ( | self | ) |
Returns the id of the cursor.
| def next | ( | self | ) |
Advance the cursor.
| def session | ( | self | ) |
The cursor's :class:`~pymongo.client_session.ClientSession`, or None. .. versionadded:: 3.6