Docs Menu
Docs Home
/ /

MongoDB\Model\CollectionInfo::getType()

Nuevo en la versión 1.9.

MongoDB\Model\CollectionInfo::getType()

Devuelve el tipo de colección.

function getType(): string

El tipo de colección. Corresponde al campo type devuelto en la respuesta del comando listCollections.

<?php
$db = (new MongoDB\Client)->test;
$db->createCollection('myCollection');
// Retrieves the collection type
foreach ($db->listCollections(['filter' => ['name' => 'myCollection']]) as $info) {
echo $info->getType();
}

El resultado sería entonces similar a lo siguiente:

collection
  • MongoDB\Database::createCollection()

  • Referencia del comandolistCollections en el manual de MongoDB

Volver

obtenerOpciones()

En esta página