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

Method list

gridfs/synchronous/grid_file.py:288–306  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

286 self._chunks.delete_many({"files_id": file_id}, session=session)
287
288 def list(self, session: Optional[ClientSession] = 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.ClientSession`
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 for name in self._files.distinct("filename", session=session) if name is not None
306 ]
307
308 def find_one(
309 self,

Callers 5

test_listMethod · 0.45
test_alt_collectionMethod · 0.45
test_listMethod · 0.45
test_alt_collectionMethod · 0.45

Calls 2

_disallow_transactionsFunction · 0.70
distinctMethod · 0.45

Tested by 5

test_listMethod · 0.36
test_alt_collectionMethod · 0.36
test_listMethod · 0.36
test_alt_collectionMethod · 0.36