MongoDB\Client::getTypeMap()

For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

MongoDB\Client::getTypeMap()

New in version 1.2

Definition

Returns the type map for this client.

function getTypeMap(): array

Return Values

A [type map](https://www.mongodb.com/docs/php-library/current/data-formats/modeling-bson-data.md#std-label-php-type-map array.

Example

<?php

$client = new MongoDB\Client('mongodb://127.0.0.1/', [], [
    'typeMap' => [
        'root' => 'array',
        'document' => 'array',
        'array' => 'array',
    ],
]);

var_dump($client->getTypeMap());

The output would then resemble:

array(3) {
  ["root"]=>
  string(5) "array"
  ["document"]=>
  string(5) "array"
  ["array"]=>
  string(5) "array"
}

See Also

  • BSON

  • [MongoDB\Collection::getTypeMap()](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbcollection-gettypemap.md#mongodb-phpmethod-phpmethod.MongoDB-Collection--getTypeMap--

  • [MongoDB\Database::getTypeMap()](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbdatabase-gettypemap.md#mongodb-phpmethod-phpmethod.MongoDB-Database--getTypeMap--

  • [MongoDB\GridFS\Bucket::getTypeMap()](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbgridfsbucket-gettypemap.md#mongodb-phpmethod-phpmethod.MongoDB-GridFS-Bucket--getTypeMap--