Join us at MongoDB.local London on 7 May to unlock new possibilities for your data. Use WEB50 to save 50%.
Register now >
Docs Menu
Docs Home
/ /

MongoDB\Model\CollectionInfo::getOptions()

MongoDB\Model\CollectionInfo::getOptions()

Devuelve las opciones de colección. Esto se correlaciona con las opciones para MongoDB\Database::createCollection()pero puede incluir campos adicionales establecidos por el servidor.

function getOptions(): array

Opciones de recopilación. Esto corresponde al campo options devuelto en la respuesta del comando listCollections.

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

La vista de salida se ilustraría como sigue:

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

  • Referencia del comando listCollections en el manual de MongoDB

Volver

getName()

En esta página