Join us at MongoDB.local London on 7 May to unlock new possibilities for your data. Use WEB50 to save 50%.
Register now >
Docs Menu
Docs Home
/ /

MongoDB\Collection::getNamespace()

MongoDB\Collection::getNamespace()

コレクションの名前空間を返します。 名前空間は、MongoDB 内のインデックスまたはコレクションの標準名です。

function getNamespace(): string

このコレクションの名前空間(string)。

次の例では、 testデータベース内のzipsコレクションの名前空間が返されます。

<?php
$collection = (new MongoDB\Client)->test->zips;
echo $collection->getNamespace();

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

test.zips
  • MongoDB\Collection::getCollectionName()

  • MongoDB\Collection::getDatabaseName()

戻る

getManager()

項目一覧