MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / max_await_time_ms

Method max_await_time_ms

pymongo/synchronous/cursor.py:507–533  ·  view source on GitHub ↗

Specifies a time limit for a getMore operation on a :attr:`~pymongo.cursor.CursorType.TAILABLE_AWAIT` cursor. For all other types of cursor max_await_time_ms is ignored. Raises :exc:`TypeError` if `max_await_time_ms` is not an integer or ``None``. Raises :exc:`~pymon

(self, max_await_time_ms: Optional[int])

Source from the content-addressed store, hash-verified

505 return self
506
507 def max_await_time_ms(self, max_await_time_ms: Optional[int]) -> Cursor[_DocumentType]:
508 """Specifies a time limit for a getMore operation on a
509 :attr:`~pymongo.cursor.CursorType.TAILABLE_AWAIT` cursor. For all other
510 types of cursor max_await_time_ms is ignored.
511
512 Raises :exc:`TypeError` if `max_await_time_ms` is not an integer or
513 ``None``. Raises :exc:`~pymongo.errors.InvalidOperation` if this
514 :class:`Cursor` has already been used.
515
516 .. note:: `max_await_time_ms` requires server version **>= 3.2**
517
518 :param max_await_time_ms: the time limit after which the operation is
519 aborted
520
521 .. versionadded:: 3.2
522 """
523 if not isinstance(max_await_time_ms, int) and max_await_time_ms is not None:
524 raise TypeError(
525 f"max_await_time_ms must be an integer or None, not {type(max_await_time_ms)}"
526 )
527 self._check_okay_to_chain()
528
529 # Ignore max_await_time_ms if not tailable or await_data is False.
530 if self._query_flags & CursorType.TAILABLE_AWAIT:
531 self._max_await_time_ms = max_await_time_ms
532
533 return self
534
535 @overload
536 def __getitem__(self, index: int) -> _DocumentType:

Callers 4

test_to_list_tailableMethod · 0.45
test_to_list_tailableMethod · 0.45

Calls 1

_check_okay_to_chainMethod · 0.95

Tested by 4

test_to_list_tailableMethod · 0.36
test_to_list_tailableMethod · 0.36