Make the MongoDB docs better! We value your opinion. Share your feedback for a chance to win $100.
Click here >
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. Esto 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();
}

La vista de salida se ilustraría como sigue:

collection
  • MongoDB\Database::createCollection()

  • Referencia del comando listCollections en el manual de MongoDB

Volver

getOptions()

En esta página