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

MongoDB\Model\CollectionInfo::getOptions()

コレクション オプションを返します。 これは、 MongoDB\Database::createCollection()の オプションと相関しますが、サーバーによって設定された追加のフィールドが含まれる場合があります。

function getOptions(): array

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

<?php
// Creates a capped collection
$db->createCollection(
'myCappedCollection',
['capped' => true, 'size' => 1048576]
);
// Retrieves the options for the collection
foreach ($db->listCollections(['filter' => ['name' => 'myCappedCollection']]) as $info) {
var_dump($info->getOptions());
}

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

array(2) {
["capped"]=>
bool(true)
["size"]=>
int(1048576)
}
  • MongoDB\Database::createCollection()

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

戻る

getName()

項目一覧