- Reference >
- MongoDB\Collection Class >
- MongoDB\Collection::getDatabaseName()
MongoDB\Collection::getDatabaseName()
On this page
Definition
-
MongoDB\Collection::getDatabaseName
Returns the name of the database containing this collection.
Return Values
The name of the database containing this collection as a string.
Example
The following returns the database name for the zips
collection in the
test
database.
The output would then resemble: