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

Method get_last_version

gridfs/asynchronous/grid_file.py:237–257  ·  view source on GitHub ↗

Get the most recent version of a file in GridFS by ``"filename"`` or metadata fields. Equivalent to calling :meth:`get_version` with the default `version` (``-1``). :param filename: ``"filename"`` of the file to get, or `None` :param session: a :

(
        self,
        filename: Optional[str] = None,
        session: Optional[AsyncClientSession] = None,
        **kwargs: Any,
    )

Source from the content-addressed store, hash-verified

235 raise NoFile("no version %d for filename %r" % (version, filename)) from None
236
237 async def get_last_version(
238 self,
239 filename: Optional[str] = None,
240 session: Optional[AsyncClientSession] = None,
241 **kwargs: Any,
242 ) -> AsyncGridOut:
243 """Get the most recent version of a file in GridFS by ``"filename"``
244 or metadata fields.
245
246 Equivalent to calling :meth:`get_version` with the default
247 `version` (``-1``).
248
249 :param filename: ``"filename"`` of the file to get, or `None`
250 :param session: a
251 :class:`~pymongo.client_session.AsyncClientSession`
252 :param kwargs: find files by custom metadata.
253
254 .. versionchanged:: 3.6
255 Added ``session`` parameter.
256 """
257 return await self.get_version(filename=filename, session=session, **kwargs)
258
259 # TODO add optional safe mode for chunk removal?
260 async def delete(self, file_id: Any, session: Optional[AsyncClientSession] = None) -> None:

Callers 1

Calls 1

get_versionMethod · 0.95

Tested by 1