Navigation
This version of the documentation is archived and no longer supported. To learn how to upgrade your version of PHP Library Manual, refer to the upgrade documentation.

MongoDB\GridFS\Bucket::drop()

Definition

MongoDB\GridFS\Bucket::drop

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

function drop(): void

Errors/Exceptions

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

Examples

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