Docs Menu
Docs Home
/ / /
PHP Library Manual
/ /

MongoDB\GridFS\Bucket::drop()

On this page

  • Definition
  • Errors/Exceptions
  • Examples
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();

Back

downloadToStreamByName()