MongoDB\Model\IndexInfo::getName()
定义
MongoDB\Model\IndexInfo::getName()
返回索引名称。这与
MongoDB\Collection::createIndex()
的返回值相对应。索引名称可以由$key
参数派生或通过name
选项显式指定。function getName(): string
返回值
索引名称。
示例
$info = new IndexInfo([ 'name' => 'x_1', ]); echo $info->getName();
输出将类似于
x_1
另请参阅
listIndexes 命令参考,见 MongoDB 手册