定義
MongoDB\Database::__construct()新しい
Databaseインスタンスを構築します。function __construct( MongoDB\Driver\Manager $manager, string $databaseName, array $options = [] )
パラメーター
$manager: MongoDB\Driver\Manager- 拡張機能からの マネージャーインスタンス。マネージャーはドライバーとMongoDBの間の接続を維持します。
$databaseName: string- データベースの名前。
$options: 配列必要なオプションを指定する配列。
名前タイプ説明builderEncoder
MongoDB\Codec\Encoder
クエリ ビルダと集計ビルダに使用するエンコード。設定されていない場合、このオプションはデフォルトで
MongoDB\Builder\BuilderEncoderクラスの新しいインスタンスになります。バージョン1.21の新機能。
ReadConcern
データベース操作に使用するデフォルトの読み取り保証 (read concern) です。 デフォルトは、マネージャーの読み取り保証 (read concern) です。
readPreference
データベース操作に使用するデフォルトの読み込み設定 (read preference) 。 デフォルトは、マネージャーの読み込み設定 (read preference) です。
typeMap
配列
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
データベース操作に使用するデフォルトの書込み保証 (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.