For AI agents: a documentation index is available at https://www.mongodb.com/pt-br/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

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"