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

Method max

pymongo/synchronous/cursor.py:644–664  ·  view source on GitHub ↗

Adds ``max`` operator that specifies upper bound for specific index. When using ``max``, :meth:`~hint` should also be configured to ensure the query uses the expected index and starting in MongoDB 4.2 :meth:`~hint` will be required. :param spec: a list of field, lim

(self, spec: _Sort)

Source from the content-addressed store, hash-verified

642 return self
643
644 def max(self, spec: _Sort) -> Cursor[_DocumentType]:
645 """Adds ``max`` operator that specifies upper bound for specific index.
646
647 When using ``max``, :meth:`~hint` should also be configured to ensure
648 the query uses the expected index and starting in MongoDB 4.2
649 :meth:`~hint` will be required.
650
651 :param spec: a list of field, limit pairs specifying the exclusive
652 upper bound for all keys of a specific index in order.
653
654 .. versionchanged:: 3.8
655 Deprecated cursors that use ``max`` without a :meth:`~hint`.
656
657 .. versionadded:: 2.7
658 """
659 if not isinstance(spec, (list, tuple)):
660 raise TypeError(f"spec must be an instance of list or tuple, not {type(spec)}")
661
662 self._check_okay_to_chain()
663 self._max = dict(spec)
664 return self
665
666 def min(self, spec: _Sort) -> Cursor[_DocumentType]:
667 """Adds ``min`` operator that specifies lower bound for specific index.

Callers 11

findMethod · 0.45
test_maxMethod · 0.45
test_cloneMethod · 0.45
findMethod · 0.45
test_maxMethod · 0.45
test_cloneMethod · 0.45
add_sidebar_buttonFunction · 0.45
scroll_sidebarFunction · 0.45
from_vectorMethod · 0.45

Calls 1

_check_okay_to_chainMethod · 0.95

Tested by 8

findMethod · 0.36
test_maxMethod · 0.36
test_cloneMethod · 0.36
findMethod · 0.36
test_maxMethod · 0.36
test_cloneMethod · 0.36