Docs Menu

Docs HomePHP Library Manual

MongoDB\Collection::getTypeMap()

On this page

  • Definition
  • Return Values
  • Example
  • See Also

New in version 1.2.

MongoDB\Collection::getTypeMap()

Returns the type map for this collection.

function getTypeMap(): array

A type map array.

<?php
$collection = (new MongoDB\Client)->selectCollection('test', 'users', [
'typeMap' => [
'root' => 'array',
'document' => 'array',
'array' => 'array',
],
]);
var_dump($collection->getTypeMap());

The output would then resemble:

array(3) {
["root"]=>
string(5) "array"
["document"]=>
string(5) "array"
["array"]=>
string(5) "array"
}
←  MongoDB\Collection::getReadPreference()MongoDB\Collection::getWriteConcern() →