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

MongoDB\GridFS\Bucket::drop()

MongoDB\GridFS\Bucket::drop()

Drops the files and chunks collections associated with this GridFS bucket.

function drop(): void

MongoDB\Driver\Exception\RuntimeException for other errors at the extension level (e.g. connection errors).

<?php
$database = (new MongoDB\Client)->test;
$bucket = $database->selectGridFSBucket();
$stream = fopen('php://temp', 'w+b');
fwrite($stream, "foobar");
rewind($stream);
$bucket->uploadFromStream('filename', $stream);
$bucket->drop();