Docs Menu

MongoDB\Model\IndexInfo::getNamespace()

MongoDB\Model\IndexInfo::getNamespace()

Return the index namespace, which is the namespace of the collection containing the index.

function getNamespace(): string

The index namespace.

<?php
$info = new IndexInfo([
'ns' => 'foo.bar',
]);
echo $info->getNamespace();

The output would then resemble:

foo.bar