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

Method __init__

gridfs/synchronous/grid_file.py:1929–1965  ·  view source on GitHub ↗

Create a new cursor, similar to the normal :class:`~pymongo.cursor.Cursor`. Should not be called directly by application developers - see the :class:`~gridfs.GridFS` method :meth:`~gridfs.GridFS.find` instead. .. versionadded 2.7 .. seealso:: The MongoDB do

(
        self,
        collection: Collection[Any],
        filter: Optional[Mapping[str, Any]] = None,
        skip: int = 0,
        limit: int = 0,
        no_cursor_timeout: bool = False,
        sort: Optional[Any] = None,
        batch_size: int = 0,
        session: Optional[ClientSession] = None,
    )

Source from the content-addressed store, hash-verified

1927 """
1928
1929 def __init__(
1930 self,
1931 collection: Collection[Any],
1932 filter: Optional[Mapping[str, Any]] = None,
1933 skip: int = 0,
1934 limit: int = 0,
1935 no_cursor_timeout: bool = False,
1936 sort: Optional[Any] = None,
1937 batch_size: int = 0,
1938 session: Optional[ClientSession] = None,
1939 ) -> None:
1940 """Create a new cursor, similar to the normal
1941 :class:`~pymongo.cursor.Cursor`.
1942
1943 Should not be called directly by application developers - see
1944 the :class:`~gridfs.GridFS` method :meth:`~gridfs.GridFS.find` instead.
1945
1946 .. versionadded 2.7
1947
1948 .. seealso:: The MongoDB documentation on `cursors <https://dochub.mongodb.org/core/cursors>`_.
1949 """
1950 _disallow_transactions(session)
1951 collection = _clear_entity_type_registry(collection)
1952
1953 # Hold on to the base "fs" collection to create GridOut objects later.
1954 self._root_collection = collection
1955
1956 super().__init__(
1957 collection.files,
1958 filter,
1959 skip=skip,
1960 limit=limit,
1961 no_cursor_timeout=no_cursor_timeout,
1962 sort=sort,
1963 batch_size=batch_size,
1964 session=session,
1965 )
1966
1967 def next(self) -> GridOut:
1968 """Get next GridOut object from cursor."""

Callers

nothing calls this directly

Calls 3

_disallow_transactionsFunction · 0.70
__init__Method · 0.45

Tested by

no test coverage detected