For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.

MongoDB\Collection::getTypeMap()

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)->getCollection('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"}