See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]
(no description)
File Size: | 738 lines (25 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
Bucket:: (30 methods):
__construct()
__debugInfo()
delete()
downloadToStream()
downloadToStreamByName()
drop()
find()
findOne()
getBucketName()
getChunksCollection()
getChunkSizeBytes()
getDatabaseName()
getFileDocumentForStream()
getFileIdForStream()
getFilesCollection()
getReadConcern()
getReadPreference()
getTypeMap()
getWriteConcern()
openDownloadStream()
openDownloadStreamByName()
openUploadStream()
rename()
uploadFromStream()
createPathForFile()
createPathForUpload()
getFilesNamespace()
getRawFileDocumentForStream()
openDownloadStreamByFile()
registerStreamWrapper()
__construct(Manager $manager, string $databaseName, array $options = []) X-Ref |
Constructs a GridFS bucket. Supported options: * bucketName (string): The bucket name, which will be used as a prefix for the files and chunks collections. Defaults to "fs". * chunkSizeBytes (integer): The chunk size in bytes. Defaults to 261120 (i.e. 255 KiB). * disableMD5 (boolean): When true, no MD5 sum will be generated for each stored file. Defaults to "false". * readConcern (MongoDB\Driver\ReadConcern): Read concern. * readPreference (MongoDB\Driver\ReadPreference): Read preference. * typeMap (array): Default type map for cursors and BSON documents. * writeConcern (MongoDB\Driver\WriteConcern): Write concern. param: Manager $manager Manager instance from the driver param: string $databaseName Database name param: array $options Bucket options |
__debugInfo() X-Ref |
Return internal properties for debugging purposes. return: array |
delete($id) X-Ref |
Delete a file from the GridFS bucket. If the files collection document is not found, this method will still attempt to delete orphaned chunks. param: mixed $id File ID |
downloadToStream($id, $destination) X-Ref |
Writes the contents of a GridFS file to a writable stream. param: mixed $id File ID param: resource $destination Writable Stream |
downloadToStreamByName(string $filename, $destination, array $options = []) X-Ref |
Writes the contents of a GridFS file, which is selected by name and revision, to a writable stream. Supported options: * revision (integer): Which revision (i.e. documents with the same filename and different uploadDate) of the file to retrieve. Defaults to -1 (i.e. the most recent 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 param: string $filename Filename param: resource $destination Writable Stream param: array $options Download options |
drop() X-Ref |
Drops the files and chunks collections associated with this GridFS bucket. |
find($filter = [], array $options = []) X-Ref |
Finds documents from the GridFS bucket's files collection matching the query. param: array|object $filter Query by which to filter documents param: array $options Additional options return: Cursor |
findOne($filter = [], array $options = []) X-Ref |
Finds a single document from the GridFS bucket's files collection matching the query. param: array|object $filter Query by which to filter documents param: array $options Additional options return: array|object|null |
getBucketName() X-Ref |
Return the bucket name. return: string |
getChunksCollection() X-Ref |
Return the chunks collection. return: Collection |
getChunkSizeBytes() X-Ref |
Return the chunk size in bytes. return: integer |
getDatabaseName() X-Ref |
Return the database name. return: string |
getFileDocumentForStream($stream) X-Ref |
Gets the file document of the GridFS file associated with a stream. param: resource $stream GridFS stream return: array|object |
getFileIdForStream($stream) X-Ref |
Gets the file document's ID of the GridFS file associated with a stream. param: resource $stream GridFS stream return: mixed |
getFilesCollection() X-Ref |
Return the files collection. return: Collection |
getReadConcern() X-Ref |
Return the read concern for this GridFS bucket. return: ReadConcern |
getReadPreference() X-Ref |
Return the read preference for this GridFS bucket. return: ReadPreference |
getTypeMap() X-Ref |
Return the type map for this GridFS bucket. return: array |
getWriteConcern() X-Ref |
Return the write concern for this GridFS bucket. return: WriteConcern |
openDownloadStream($id) X-Ref |
Opens a readable stream for reading a GridFS file. param: mixed $id File ID return: resource |
openDownloadStreamByName(string $filename, array $options = []) X-Ref |
Opens a readable stream stream to read a GridFS file, which is selected by name and revision. Supported options: * revision (integer): Which revision (i.e. documents with the same filename and different uploadDate) of the file to retrieve. Defaults to -1 (i.e. the most recent 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 param: string $filename Filename param: array $options Download options return: resource |
openUploadStream(string $filename, array $options = []) X-Ref |
Opens a writable stream for writing a GridFS file. Supported options: * _id (mixed): File document identifier. Defaults to a new ObjectId. * chunkSizeBytes (integer): The chunk size in bytes. Defaults to the bucket's chunk size. * disableMD5 (boolean): When true, no MD5 sum will be generated for the stored file. Defaults to "false". * metadata (document): User data for the "metadata" field of the files collection document. param: string $filename Filename param: array $options Upload options return: resource |
rename($id, string $newFilename) X-Ref |
Renames the GridFS file with the specified ID. param: mixed $id File ID param: string $newFilename New filename |
uploadFromStream(string $filename, $source, array $options = []) X-Ref |
Writes the contents of a readable stream to a GridFS file. Supported options: * _id (mixed): File document identifier. Defaults to a new ObjectId. * chunkSizeBytes (integer): The chunk size in bytes. Defaults to the bucket's chunk size. * disableMD5 (boolean): When true, no MD5 sum will be generated for the stored file. Defaults to "false". * metadata (document): User data for the "metadata" field of the files collection document. param: string $filename Filename param: resource $source Readable stream param: array $options Stream options return: mixed ID of the newly created GridFS file |
createPathForFile(object $file) X-Ref |
Creates a path for an existing GridFS file. param: object $file GridFS file document |
createPathForUpload() X-Ref |
Creates a path for a new GridFS file, which does not yet have an ID. |
getFilesNamespace() X-Ref |
Returns the names of the files collection. |
getRawFileDocumentForStream($stream) X-Ref |
Gets the file document of the GridFS file associated with a stream. This returns the raw document from the StreamWrapper, which does not respect the Bucket's type map. param: resource $stream GridFS stream |
openDownloadStreamByFile(object $file) X-Ref |
Opens a readable stream for the GridFS file. param: object $file GridFS file document return: resource |
registerStreamWrapper() X-Ref |
Registers the GridFS stream wrapper if it is not already registered. |