Method | Description | |
---|---|---|
__construct ( MongoDB\Driver\Manager $manager, string $databaseName, array $options = [] ) | Constructs a GridFS bucket. | |
delete ( mixed $id ) | Delete a file from the GridFS bucket. | |
downloadToStream ( mixed $id, resource $destination ) | Writes the contents of a GridFS file to a writable stream. | |
downloadToStreamByName ( string $filename, resource $destination, array $options = [] ) | Writes the contents of a GridFS file, which is selected by name and revision, to a writable stream. | |
drop ( ) | Drops the files and chunks collections associated with this GridFS bucket. | |
find ( array | object $filter, array $options = [] ) : MongoDB\Driver\Cursor | Finds documents from the GridFS bucket's files collection matching the query. | |
getCollectionWrapper ( ) | ||
getDatabaseName ( ) | ||
getIdFromStream ( resource $stream ) : mixed | Gets the ID of the GridFS file associated with a stream. | |
openDownloadStream ( mixed $id ) : resource | Opens a readable stream for reading a GridFS file. | |
openDownloadStreamByName ( string $filename, array $options = [] ) : resource | Opens a readable stream stream to read a GridFS file, which is selected by name and revision. | |
openUploadStream ( string $filename, array $options = [] ) : resource | Opens a writable stream for writing a GridFS file. | |
rename ( mixed $id, string $newFilename ) | Renames the GridFS file with the specified ID. | |
uploadFromStream ( string $filename, resource $source, array $options = [] ) : MongoDB\BSON\ObjectId | Writes the contents of a readable stream to a GridFS file. |
Method | Description | |
---|---|---|
createPathForFile ( stdClass $file ) : string | Creates a path for an existing GridFS file. | |
createPathForUpload ( ) : string | Creates a path for a new GridFS file, which does not yet have an ID. | |
getFilesNamespace ( ) : string | Returns the names of the files collection. | |
openDownloadStreamByFile ( stdClass $file ) : resource | Opens a readable stream for the GridFS file. | |
registerStreamWrapper ( ) | Registers the GridFS stream wrapper if it is not already registered. |
public __construct ( MongoDB\Driver\Manager $manager, string $databaseName, array $options = [] ) | ||
$manager | MongoDB\Driver\Manager | Manager instance from the driver |
$databaseName | string | Database name |
$options | array | Bucket options |
public downloadToStream ( mixed $id, resource $destination ) | ||
$id | mixed | File ID |
$destination | resource | Writable Stream |
public downloadToStreamByName ( string $filename, resource $destination, array $options = [] ) | ||
$filename | string | Filename |
$destination | resource | Writable Stream |
$options | array | Download options |
public drop ( ) |
public getIdFromStream ( resource $stream ) : mixed | ||
$stream | resource | GridFS stream |
return | mixed |
public openDownloadStream ( mixed $id ) : resource | ||
$id | mixed | File ID |
return | resource |
public openDownloadStreamByName ( string $filename, array $options = [] ) : resource | ||
$filename | string | Filename |
$options | array | Download options |
return | resource |
public openUploadStream ( string $filename, array $options = [] ) : resource | ||
$filename | string | Filename |
$options | array | Upload options |
return | resource |
public uploadFromStream ( string $filename, resource $source, array $options = [] ) : MongoDB\BSON\ObjectId | ||
$filename | string | Filename |
$source | resource | Readable stream |
$options | array | Stream options |
return | MongoDB\BSON\ObjectId | ID of the newly created GridFS file |