MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / max_time_ms

Method max_time_ms

pymongo/synchronous/cursor.py:488–505  ·  view source on GitHub ↗

Specifies a time limit for a query operation. If the specified time is exceeded, the operation will be aborted and :exc:`~pymongo.errors.ExecutionTimeout` is raised. If `max_time_ms` is ``None`` no limit is applied. Raises :exc:`TypeError` if `max_time_ms` is not an

(self, max_time_ms: Optional[int])

Source from the content-addressed store, hash-verified

486 return self
487
488 def max_time_ms(self, max_time_ms: Optional[int]) -> Cursor[_DocumentType]:
489 """Specifies a time limit for a query operation. If the specified
490 time is exceeded, the operation will be aborted and
491 :exc:`~pymongo.errors.ExecutionTimeout` is raised. If `max_time_ms`
492 is ``None`` no limit is applied.
493
494 Raises :exc:`TypeError` if `max_time_ms` is not an integer or ``None``.
495 Raises :exc:`~pymongo.errors.InvalidOperation` if this :class:`Cursor`
496 has already been used.
497
498 :param max_time_ms: the time limit after which the operation is aborted
499 """
500 if not isinstance(max_time_ms, int) and max_time_ms is not None:
501 raise TypeError(f"max_time_ms must be an integer or None, not {type(max_time_ms)}")
502 self._check_okay_to_chain()
503
504 self._max_time_ms = max_time_ms
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

Callers 6

test_max_time_msMethod · 0.45
test_max_time_msMethod · 0.45

Calls 1

_check_okay_to_chainMethod · 0.95

Tested by 6

test_max_time_msMethod · 0.36
test_max_time_msMethod · 0.36