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

Method list

gridfs/asynchronous/grid_file.py:288–308  ·  view source on GitHub ↗

List the names of all files stored in this instance of :class:`GridFS`. :param session: a :class:`~pymongo.client_session.AsyncClientSession` .. versionchanged:: 3.6 Added ``session`` parameter. .. versionchanged:: 3.1 ``list`` no

(self, session: Optional[AsyncClientSession] = None)

Source from the content-addressed store, hash-verified

286 await self._chunks.delete_many({"files_id": file_id}, session=session)
287
288 async def list(self, session: Optional[AsyncClientSession] = None) -> list[str]:
289 """List the names of all files stored in this instance of
290 :class:`GridFS`.
291
292 :param session: a
293 :class:`~pymongo.client_session.AsyncClientSession`
294
295 .. versionchanged:: 3.6
296 Added ``session`` parameter.
297
298 .. versionchanged:: 3.1
299 ``list`` no longer ensures indexes.
300 """
301 _disallow_transactions(session)
302 # With an index, distinct includes documents with no filename
303 # as None.
304 return [
305 name
306 for name in await self._files.distinct("filename", session=session)
307 if name is not None
308 ]
309
310 async def find_one(
311 self,

Callers 1

Calls 2

_disallow_transactionsFunction · 0.70
distinctMethod · 0.45

Tested by 1