Docs Menu
Docs Home
/ / /
PHP Library Manual
/ / /

MongoDB\Model\CollectionInfo::getOptions()

On this page

  • Definition
  • Return Values
  • Examples
  • See Also
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
$info = new CollectionInfo([
'name' => 'foo',
'options' => [
'capped' => true,
'size' => 1048576,
]
]);
var_dump($info->getOptions());

The output would then resemble:

array(2) {
["capped"]=>
bool(true)
["size"]=>
int(1048576)
}
  • MongoDB\Database::createCollection()

  • listCollections command reference in the MongoDB manual

← MongoDB\Model\CollectionInfo::getName()