MongoDBDatabase-getDatabaseName.txt 697 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
   :returns:
25

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

Example
-------

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

.. code-block:: php

35 36
   <?php

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

   echo $db->getDatabaseName();

The output would then resemble::

   demo