def get_last_version(self, filename):
        """Get a file from GridFS by ``"filename"``.

        Returns the most recently uploaded file in GridFS with the
        name `filename` as an instance of
        :class:`~gridfs.grid_file.GridOut`. Raises
        :class:`~gridfs.errors.NoFile` if no such file exists.

        An index on ``{filename: 1, uploadDate: -1}`` will
        automatically be created when this method is called the first
        time.

        :Parameters:
          - `filename`: ``"filename"`` of the file to get

        .. versionadded:: 1.6
        """
        def ok(doc):
            if doc is None:
                raise NoFile("TxMongo: no file in gridfs with filename {0}".format(repr(filename)))

            return GridOut(self.__collection, doc)

        return self.__files.find_one({"filename": filename},
                                     filter = filter.sort(DESCENDING("uploadDate"))).addCallback(ok)
def get_last_version ( self , filename ) : def ok ( doc ) : if doc is None : raise NoFile ( "TxMongo: no file in gridfs with filename {0}" . format ( repr ( filename ) ) ) return GridOut ( self . __collection , doc ) return self . __files . find_one ( { "filename" : filename } , filter = filter . sort ( DESCENDING ( "uploadDate" ) ) ) . addCallback ( ok )
Get a file from GridFS by ``"filename"``.

        Returns the most recently uploaded file in GridFS with the
        name `filename` as an instance of
        :class:`~gridfs.grid_file.GridOut`. Raises
        :class:`~gridfs.errors.NoFile` if no such file exists.

        An index on ``{filename: 1, uploadDate: -1}`` will
        automatically be created when this method is called the first
        time.

        :Parameters:
          - `filename`: ``"filename"`` of the file to get

        .. versionadded:: 1.6