public function findFileByFilenameAndRevision($filename, $revision)
    {
        $filename = (string) $filename;
        $revision = (integer) $revision;

        if ($revision < 0) {
            $skip = abs($revision) - 1;
            $sortOrder = -1;
        } else {
            $skip = $revision;
            $sortOrder = 1;
        }

        return $this->filesCollection->findOne(
            ['filename' => $filename],
            [
                'skip' => $skip,
                'sort' => ['uploadDate' => $sortOrder],
                'typeMap' => ['root' => 'stdClass'],
            ]
        );
    }
public function findFileByFilenameAndRevision($filename, $revision)
    {
        $filename = (string) $filename;
        $revision = (integer) $revision;

        if ($revision < 0) {
            $skip = abs($revision) - 1;
            $sortOrder = -1;
        } else {
            $skip = $revision;
            $sortOrder = 1;
        }

        return $this->filesCollection->findOne(
            ['filename' => $filename],
            [
                'skip' => $skip,
                'sort' => ['uploadDate' => $sortOrder],
                'typeMap' => ['root' => 'stdClass'],
            ]
        );
    }
public function findFileByFilenameAndRevision ( $ filename , $ revision ) { $ filename = ( string ) $ filename ; $ revision = ( integer ) $ revision ; if ( $ revision < 0 ) { $ skip = abs ( $ revision ) - 1 ; $ sortOrder = - 1 ; } else { $ skip = $ revision ; $ sortOrder = 1 ; } return $ this -> filesCollection -> findOne ( [ 'filename' => $ filename ] , [ 'skip' => $ skip , 'sort' => [ 'uploadDate' => $ sortOrder ] , 'typeMap' => [ 'root' => 'stdClass' ] , ] ) ; }
Finds a GridFS file document for a given filename and revision.

Revision numbers are defined as follows:

* 0 = the original stored file
* 1 = the first revision
* 2 = the second revision
* etc…
* -2 = the second most recent revision
* -1 = the most recent revision

@see Bucket::downloadToStreamByName()
@see Bucket::openDownloadStreamByName()
@param string $filename
@param integer $revision
@return stdClass|null
Finds a GridFS file document for a given filename and revision .