For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
MongoDB\Database::getDatabaseName()
Definition
MongoDB\Database::getDatabaseName()
Returns the name of this database.
functiongetDatabaseName(): string
Return Values
The name of this database as a string.
Example
The following example prints the name of a database object: