1.9版本新增。
定义
Return Values
包含有关collection的额外信息的数组。这对应于listCollections命令回复中返回的info字段。
示例
$db = (new MongoDB\Client)->test;
// Creates a view with the readOnly option set to "true"$db->createCollection( 'myView', ['viewOn' => 'myCollection'], ['readOnly' => true]);
// Retrieves information about the collection viewforeach ($db->listCollections(['filter' => ['name' => 'myView']]) as $info) { var_dump($info->getInfo());}而输出将类似如下所示:
array(1) { ["readOnly"]=> bool(true)}另请参阅
MongoDB 手册中的listCollections命令参考