For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.

MongoDB\Model\CollectionInfo::getInfo()

New in version 1.9.

MongoDB\Model\CollectionInfo::getInfo()

Returns additional information about the collection.

function getInfo(): array

An array containing extra information about the collection. This corresponds to the info field returned in the listCollections command reply.

<?php $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());}

The output would then resemble:

array(1) { ["readOnly"]=> bool(true)}