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::getType()

バージョン 1.9 の新機能

MongoDB\Model\CollectionInfo::getType()

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

function getType(): string

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

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

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

collection
  • MongoDB\Database::createCollection()

  • MongoDB マニュアルのlistCollectionsコマンド参照

戻る

getOptions()

項目一覧