Learn the "why" behind slow queries and how to fix them in our 2-Part Webinar.
Register now >
Docs Menu
Docs Home
/ /

MongoDB\Model\IndexInfo::getKey()

MongoDB\Model\IndexInfo::getKey()

インデックス仕様( インデックス フィールドと順序)。 これは、 MongoDB\Collection::createIndex()$keyパラメータと相関します。

function getKey(): array

連想配列としてのインデックス仕様。

<?php
$info = new IndexInfo([
'key' => ['x' => 1],
]);
var_dump($info->getKey());

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

array(1) {
["x"]=>
int(1)
}
  • MongoDB\Collection::createIndex()

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

戻る

IndexInfo

項目一覧