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

Method max_scan

pymongo/synchronous/cursor.py:625–642  ·  view source on GitHub ↗

**DEPRECATED** - Limit the number of documents to scan when performing the query. Raises :class:`~pymongo.errors.InvalidOperation` if this cursor has already been used. Only the last :meth:`max_scan` applied to this cursor has any effect. :param max_scan: th

(self, max_scan: Optional[int])

Source from the content-addressed store, hash-verified

623 raise IndexError("Cursor does not support indexing")
624
625 def max_scan(self, max_scan: Optional[int]) -> Cursor[_DocumentType]:
626 """**DEPRECATED** - Limit the number of documents to scan when
627 performing the query.
628
629 Raises :class:`~pymongo.errors.InvalidOperation` if this
630 cursor has already been used. Only the last :meth:`max_scan`
631 applied to this cursor has any effect.
632
633 :param max_scan: the maximum number of documents to scan
634
635 .. versionchanged:: 3.7
636 Deprecated :meth:`max_scan`. Support for this option is deprecated in
637 MongoDB 4.0. Use :meth:`max_time_ms` instead to limit server side
638 execution time.
639 """
640 self._check_okay_to_chain()
641 self._max_scan = max_scan
642 return self
643
644 def max(self, spec: _Sort) -> Cursor[_DocumentType]:
645 """Adds ``max`` operator that specifies upper bound for specific index.

Callers

nothing calls this directly

Calls 1

_check_okay_to_chainMethod · 0.95

Tested by

no test coverage detected