정의
매개변수
$id: 혼합- 이름을 바꿀 파일 의
_id입니다. $newFilename: 문자열- 새
filename값입니다.
오류/예외
MongoDB\GridFS\Exception\FileNotFoundException 선택 기준에 맞는 파일을 찾을 수 없는 경우.
확장 수준의 기타 오류에 대한MongoDB\ 드라이버\Exception\RuntimeException (예: 연결 오류).
예시
$bucket = (new MongoDB\Client)->test->selectGridFSBucket();
$stream = fopen('php://temp', 'w+b');fwrite($stream, "foobar");rewind($stream);
$id = $bucket->uploadFromStream('a', $stream);
$bucket->rename($id, 'b');
var_dump(stream_get_contents($bucket->openDownloadStreamByName('b')));이 경우 출력은 다음과 유사합니다:
string(6) "foobar"