For AI agents: a documentation index is available at https://www.mongodb.com/ko-kr/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Make the MongoDB docs better! We value your opinion. Share your feedback for a chance to win $100.
MongoDB Branding Shape
Click here >
Docs Menu

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"
}