Docs Menu
Docs Home
/ / /
PHP Library Manual
/ / /

MongoDB\Model\CollectionInfo::getIdIndex()

On this page

  • Definition
  • Return Values
  • Examples
  • See Also

New in version 1.9.

MongoDB\Model\CollectionInfo::getIdIndex()

Returns information about the _id field index.

function getIdIndex(): array

An array containing information on the _id index. This corresponds to the idIndex field returned in the listCollections command reply.

<?php
$info = new CollectionInfo([
'type' => 'view',
'name' => 'foo',
'idIndex' => [
'v' => 2,
'key' => ['_id' => 1],
'name' => '_id',
'ns' => 'test.foo',
],
]);
var_dump($info->getIdIndex());

The output would then resemble:

array(4) {
["v"]=>
int(2)
["key"]=>
array(1) {
["_id"]=>
int(1)
}
["name"]=>
string(3) "_id"
["ns"]=>
string(8) "test.foo"
}
  • MongoDB\Database::createCollection()

  • listCollections command reference in the MongoDB manual

Back

getCappedSize()