バージョン 1.9 の新機能。
定義
Return Values
_id
インデックスに関する情報を含む配列。 これは、 listCollections
コマンドの応答で返されるidIndex
フィールドに対応します。
例
$db = (new MongoDB\Client)->test; $db->createCollection('myCollection'); // Retrieves the _id index information foreach ($db->listCollections(['filter' => ['name' => 'myCollection']]) as $info) { var_dump($info->getIdIndex()); }
出力は次のようになります。
array(3) { 'v' => int(2) 'key' => array(1) { '_id' => int(1) } 'name' => string(4) "_id_" }
その他の参照
MongoDB マニュアルのlistCollectionsコマンド参照