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::getOptions()

MongoDB\Model\CollectionInfo::getOptions()

Return the collection options. This correlates with the options for MongoDB\Database::createCollection(), but may include additional fields set by the server.

function getOptions(): array

The collection options. This corresponds to the options field returned in the listCollections command reply.

<?php // Creates a capped collection$db->createCollection( 'myCappedCollection', ['capped' => true, 'size' => 1048576]); // Retrieves the options for the collectionforeach ($db->listCollections(['filter' => ['name' => 'myCappedCollection']]) as $info) { var_dump($info->getOptions());}

The output would then resemble:

array(2) { ["capped"]=> bool(true) ["size"]=> int(1048576)}