Docs Home → PHP Library Manual
MongoDB\Database::getDatabaseName()
On this page
Definition
Return Values
The name of this database as a string.
Example
The following example prints the name of a database object:
$db = (new MongoDB\Client)->test; echo $db->getDatabaseName();
The output would then resemble:
test