Docs Menu

Docs HomePHP Library Manual


On this page

  • Definition
  • Return Values
  • Examples
  • See Also

New in version 1.9.


Return the collection type.

function getType(): string

The collection type. This corresponds to the type field returned in the listCollections command reply.

$info = new CollectionInfo(['type' => 'collection', 'name' => 'foo']);
echo $info->getType();

The output would then resemble:

  • MongoDB\Database::createCollection()

  • listCollections command reference in the MongoDB manual

← MongoDB\Model\CollectionInfo::getOptions()