Navigation
This version of the documentation is archived and no longer supported. To learn how to upgrade your version of PHP Library Manual, refer to the upgrade documentation.

MongoDB\Database::getTypeMap()

New in version 1.2.

Definition

MongoDB\Database::getTypeMap

Returns the type map for this database.

function getTypeMap(): array

Return Values

A type map array.

Example

<?php

$database = (new MongoDB\Client)->selectDatabase('test', [
    'typeMap' => [
        'root' => 'array',
        'document' => 'array',
        'array' => 'array',
    ],
]);

var_dump($database->getTypeMap());

The output would then resemble:

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