Join us Sept 17 at .local NYC! Use code WEB50 to save 50% on tickets. Learn more >
MongoDB Event
Docs Menu
Docs Home
/ / /
PHP Library Manual
/ /

MongoDB\GridFS\Bucket::getFilesCollection()

New in version 1.2.

MongoDB\GridFS\Bucket::getFilesCollection()

Returns the files collection used by the bucket.

function getFilesCollection(): MongoDB\Collection

A MongoDB\Collection object for the files collection.

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

The output would then resemble:

string(8) "fs.files"

Back

getFileIdForStream()

On this page