AI エージェント向け: ドキュメントインデックスは https://www.mongodb.com/ja-jp/docs/llms.txt で利用できます。すべてのページの markdown バージョンは、いずれかの URL パスに .md を追加することで利用できます。

MongoDB\Model\CollectionInfo::getType()

バージョン1.9の新機能。

MongoDB\Model\CollectionInfo::getType()

コレクションの種類を返します。

function getType(): string

コレクションの種類。 これは、 listCollectionsコマンドの応答で返されるtypeフィールドに対応します。

<?php $db = (new MongoDB\Client)->test; $db->createCollection('myCollection'); // Retrieves the collection typeforeach ($db->listCollections(['filter' => ['name' => 'myCollection']]) as $info) { echo $info->getType();}

出力は次のようになります。

collection