Docs Menu

Docs HomePHP Library Manual

MongoDB\GridFS\Bucket::getDatabaseName()

On this page

  • Definition
  • Return Values
  • Examples
MongoDB\GridFS\Bucket::getDatabaseName()

Returns the name of the database containing this bucket.

function getDatabaseName(): string

The name of the database containing this bucket as a string.

<?php
$bucket = (new MongoDB\Client)->test->selectGridFSBucket();
var_dump($bucket->getDatabaseName());

The output would then resemble:

string(4) "test"
←  MongoDB\GridFS\Bucket::getChunkSizeBytes()MongoDB\GridFS\Bucket::getFileDocumentForStream() →