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

Method to_list

gridfs/synchronous/grid_file.py:1973–1982  ·  view source on GitHub ↗

Convert the cursor to a list.

(self, length: Optional[int] = None)

Source from the content-addressed store, hash-verified

1971 return GridOut(self._root_collection, file_document=next_file, session=self.session)
1972
1973 def to_list(self, length: Optional[int] = None) -> list[GridOut]:
1974 """Convert the cursor to a list."""
1975 if length is None:
1976 return [x for x in self] # noqa: C416,RUF100
1977 if length < 1:
1978 raise ValueError("to_list() length must be greater than 0")
1979 ret = []
1980 for _ in range(length):
1981 ret.append(self.next())
1982 return ret
1983
1984 __next__ = next
1985

Callers

nothing calls this directly

Calls 1

nextMethod · 0.95

Tested by

no test coverage detected