Definition
- MongoDB\GridFS\Bucket::__construct()
- Constructs a new - Bucketinstance.- function __construct( - MongoDB\Driver\Manager $manager, - string $databaseName, - array $options = [] - ) 
Parameters
- $manager: MongoDB\Driver\Manager
- The Manager instance from the extension. The manager maintains connections between the driver and MongoDB.
- $databaseName: string
- The name of the database.
- $options: array
- An array specifying the desired options. NameTypeDescription- 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).- codec - MongoDB\Codec\DocumentCodec - The default Encode Data with Type Codecs to use for bucket methods that return a file document (e.g. - MongoDB\GridFS\Bucket::find()).- New in version 1.17. - readConcern - The default read concern to use for bucket operations. Defaults to the manager's read concern. - readPreference - The default read preference to use for bucket operations. Defaults to the manager's read preference. - typeMap - array - Default type map to apply to cursors, which determines how BSON documents are converted to PHP values. The library uses the following type map by default: - [ - 'array' => 'MongoDB\Model\BSONArray', - 'document' => 'MongoDB\Model\BSONDocument', - 'root' => 'MongoDB\Model\BSONDocument', - ] - writeConcern - The default write concern to use for bucket operations. Defaults to the manager's write concern. 
Errors/Exceptions
MongoDB\Exception\InvalidArgumentException for errors related to
the parsing of parameters or options.
Behavior
If you construct a Bucket explicitly, the Bucket inherits any options
from the MongoDB\Driver\Manager object.
If you select the Bucket from a Database object,
the Bucket inherits its options from that object.
Examples
$bucket = (new MongoDB\Client)->test->selectGridFSBucket(); var_dump($bucket); 
The output would then resemble:
object(MongoDB\GridFS\Bucket)#3053 (2) {   ["bucketName"]=>   string(4) "test"   ["databaseName"]=>   string(11) "phplib_test" }