定义
MongoDB\Database::__construct()构造一个新的
Database实例。function __construct( MongoDB\Driver\Manager $manager, string $databaseName, array $options = [] )
参数
$manager: MongoDB\ 驱动程序\ 经理- 扩展中的经理实例。管理器维护驾驶员和MongoDB之间的连接。
$databaseName: 细绳- 数据库的名称。
$options: array指定所需选项的数组。
名称类型说明builderEncoder
MongoDB\Codec\Encoder
用于查询和聚合构建者的编码器。如果未设立,此选项默认为
MongoDB\Builder\BuilderEncoder类的新实例。1.21版本新增。
事务外的
用于数据库操作的默认读关注(read concern)。默认为经理的读关注(read concern)。
readPreference
用于数据库操作的默认读取偏好(read preference)。默认为经理的读取偏好(read preference)。
typeMap
阵列
writeConcern
用于数据库操作的默认写关注(write concern)。默认为经理的写关注(write concern)。
错误/异常
MongoDB\Exception\InvalidArgumentException 用于与参数或选项解析相关的错误。
行为
If you construct a Database explicitly, the Database inherits any options from the MongoDB\Driver\Manager object. If you select the Database from a Client object, the Database inherits its options from that object.