- Reference >
- MongoDB\GridFS\Bucket Class >
- MongoDB\GridFS\Bucket::rename()
MongoDB\GridFS\Bucket::rename()
On this page
Definition
-
MongoDB\GridFS\Bucket::rename Selects a GridFS file by its
_idand alters itsfilename.This method has the following parameters:
Parameter Type Description $idmixed The _idof the file.$newFilenamestring The new filenamevalue.
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).
Examples
The output would then resemble:
string(6) "foobar"