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

MongoDB\Model\CollectionInfo::getName()

Devuelve el nombre de la colección.

function getName(): string

El nombre de la colección. Esto corresponde al campo name devuelto en la respuesta del comando listCollections.

<?php
$db->createCollection('foo');
// Retrieves the collection name
foreach ($db->listCollections(['filter' => ['name' => 'foo']]) as $info) {
echo $info->getName();
}

La vista de salida se ilustraría como sigue:

foo
  • MongoDB\Collection::getCollectionName()

  • Referencia del comando listCollections en el manual de MongoDB

Volver

getInfo()

En esta página