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

Method to_list

gridfs/asynchronous/grid_file.py:1987–1996  ·  view source on GitHub ↗

Convert the cursor to a list.

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

Source from the content-addressed store, hash-verified

1985 return AsyncGridOut(self._root_collection, file_document=next_file, session=self.session)
1986
1987 async def to_list(self, length: Optional[int] = None) -> list[AsyncGridOut]:
1988 """Convert the cursor to a list."""
1989 if length is None:
1990 return [x async for x in self] # noqa: C416,RUF100
1991 if length < 1:
1992 raise ValueError("to_list() length must be greater than 0")
1993 ret = []
1994 for _ in range(length):
1995 ret.append(await self.next())
1996 return ret
1997
1998 __anext__ = next
1999

Callers

nothing calls this directly

Calls 1

nextMethod · 0.95

Tested by

no test coverage detected