Learn the "why" behind slow queries and how to fix them in our 2-Part Webinar.
Register now >
Docs Menu
Docs Home
/ /

MongoDB\Database::getDatabaseName()

MongoDB\Database::getDatabaseName()

このデータベースの名前を返します。

function getDatabaseName(): string

このデータベースの名前(string)。

次の例では、データベース オブジェクトの名前を出力します。

<?php
$db = (new MongoDB\Client)->test;
echo $db->getDatabaseName();

出力は次のようになります。

test

戻る

getCollection()

項目一覧