For AI agents: a documentation index is available at https://www.mongodb.com/pt-br/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

MongoDB\Model\IndexInfo::getName()

MongoDB\Model\IndexInfo::getName()

Return the index name. This correlates with the return value of MongoDB\Collection::createIndex(). An index name may be derived from the $key parameter or explicitly specified via the name option.

function getName(): string

The index name.

<?php
$info = new IndexInfo([
'name' => 'x_1',
]);
echo $info->getName();

The output would then resemble:

x_1