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

Method get

gridfs/asynchronous/grid_file.py:159–176  ·  view source on GitHub ↗

Get a file from GridFS by ``"_id"``. Returns an instance of :class:`~gridfs.grid_file.GridOut`, which provides a file-like interface for reading. :param file_id: ``"_id"`` of the file to get :param session: a :class:`~pymongo.client_session.AsyncClientSe

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

Source from the content-addressed store, hash-verified

157 return grid_file._id
158
159 async def get(self, file_id: Any, session: Optional[AsyncClientSession] = None) -> AsyncGridOut:
160 """Get a file from GridFS by ``"_id"``.
161
162 Returns an instance of :class:`~gridfs.grid_file.GridOut`,
163 which provides a file-like interface for reading.
164
165 :param file_id: ``"_id"`` of the file to get
166 :param session: a
167 :class:`~pymongo.client_session.AsyncClientSession`
168
169 .. versionchanged:: 3.6
170 Added ``session`` parameter.
171 """
172 gout = AsyncGridOut(self._collection, file_id, session=session)
173
174 # Raise NoFile now, instead of on first attribute access.
175 await gout.open()
176 return gout
177
178 async def get_version(
179 self,

Callers 3

__init__Method · 0.45
_flush_dataMethod · 0.45

Calls 2

openMethod · 0.95
AsyncGridOutClass · 0.85

Tested by 1