Join us Sept 17 at .local NYC! Use code WEB50 to save 50% on tickets. Learn more >
MongoDB Event
Docs Menu
Docs Home
/ / /
PHP ライブラリ マニュアル
/ / /

MongoDB\Model\CollectionInfo::getName()

MongoDB\Model\CollectionInfo::getName()

コレクション名を返します。

function getName(): string

コレクション名。 これは、 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()

項目一覧