MongoDBDatabase-getDatabaseName.txt 706 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
====================================
MongoDB\\Database::getDatabaseName()
====================================

.. default-domain:: mongodb

.. contents:: On this page
   :local:
   :backlinks: none
   :depth: 1
   :class: singlecol

Definition
----------

16 17 18
.. phpmethod:: MongoDB\\Database::getDatabaseName()

   Returns the name of this database.
19 20

   .. code-block:: php
21

22 23
      function getDatabaseName(): string

24 25
Return Values
-------------
26

27
The name of this database as a string.
28 29 30 31

Example
-------

32
The following example prints the name of a database object:
33 34 35

.. code-block:: php

36 37
   <?php

38 39 40 41 42 43 44
   $db = (new MongoDB\Client)->demo;

   echo $db->getDatabaseName();

The output would then resemble::

   demo