Join us Sept 17 at .local NYC! Use code WEB50 to save 50% on tickets. Learn more >
MongoDB Event
Docs 菜单
Docs 主页
/ / /
PHP 库手册
/ / /

MongoDB\Model\CollectionInfo::getName()

MongoDB\Model\CollectionInfo::getName()

返回collection名称。

function getName(): string

collection名称。这对应于listCollections命令回复中返回的name字段。

<?php
$db->createCollection('foo');
// Retrieves the collection name
foreach ($db->listCollections(['filter' => ['name' => 'foo']]) as $info) {
echo $info->getName();
}

而输出将类似如下所示:

foo
  • MongoDB\Collection::getCollectionName()

  • MongoDB 手册中的listCollections命令参考

后退

getInfo()

在此页面上