ANNOUNCEMENT: Voyage AI joins MongoDB to power more accurate and trustworthy AI applications on Atlas.
Learn more
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 拡張レベルのその他のエラー(例:)。

<?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();