Docs Menu

MongoDB\Model\CollectionInfo::getName()

MongoDB\Model\CollectionInfo::getName()

Return the collection name.

function getName(): string

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

<?php
$info = new CollectionInfo(['name' => 'foo']);
echo $info->getName();

The output would then resemble:

foo