Navigation
This version of the documentation is archived and no longer supported. To learn how to upgrade your version of PHP Library Manual, refer to the upgrade documentation.

MongoDB\GridFS\Bucket::rename()

Definition

MongoDB\GridFS\Bucket::rename

Selects a GridFS file by its _id and alters its filename.

function rename($id, $newFilename): void

This method has the following parameters:

Parameter Type Description
$id mixed The _id of the file.
$newFilename string The new filename value.

Errors/Exceptions

MongoDB\GridFS\Exception\FileNotFoundException if no file was found for the selection criteria.

MongoDB\Driver\Exception\RuntimeException for other errors at the driver level (e.g. connection errors).