Docs Menu
Docs Home
/ / /
PHP Library Manual
/ / /

MongoDB\Model\IndexInfo::getNamespace()

On this page

  • Definition
  • Return Values
  • Examples
  • See Also
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
  • MongoDB\Collection::createIndex()

  • MongoDB\Collection::getNamespace()

  • listIndexes command reference in the MongoDB manual

← MongoDB\Model\IndexInfo::getName()