1.9版本新增。
定义
Return Values
包含_id索引信息的大量。 这对应于listCollections命令回复中返回的idIndex字段。
示例
$db = (new MongoDB\Client)->test;
$db->createCollection('myCollection');
// Retrieves the _id index informationforeach ($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命令参考