Docs Menu
Docs Home
/ / /
PHP ライブラリ マニュアル
/ / /

MongoDB\Model\CollectionInfo::getInfo()

バージョン 1.9 の新機能

MongoDB\Model\CollectionInfo::getInfo()

コレクションに関する追加情報を返します。

function getInfo(): array

コレクションに関する追加情報を含む配列。 これは、 listCollectionsコマンドの応答で返されるinfoフィールドに対応します。

<?php
$db = (new MongoDB\Client)->test;
// Creates a view with the readOnly option set to "true"
$db->createCollection(
'myView',
['viewOn' => 'myCollection'],
['readOnly' => true]
);
// Retrieves information about the collection view
foreach ($db->listCollections(['filter' => ['name' => 'myView']]) as $info) {
var_dump($info->getInfo());
}

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

array(1) {
["readOnly"]=>
bool(true)
}
  • MongoDB\Database::createCollection()

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

戻る

getIdIndex()

項目一覧