Navigation

MongoDB\Database::getDatabaseName()

Definition

MongoDB\Database::getDatabaseName

Returns the name of this database.

function getDatabaseName(): string

Return Values

The name of this database as a string.

Example

The following example prints the name of a database object:

<?php

$db = (new MongoDB\Client)->test;

echo $db->getDatabaseName();

The output would then resemble:

test