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::getFileDocumentForStream()

Definition

MongoDB\GridFS\Bucket::getFileDocumentForStream

Gets the file document of the GridFS file associated with a stream.

function getFileDocumentForStream($stream): array|object

This method has the following parameters:

Parameter Type Description
$stream resource The GridFS stream resource.

Return Values

The metadata document associated with the GridFS stream. The return type will depend on the bucket’s typeMap option.

Errors/Exceptions

MongoDB\Exception\InvalidArgumentException for errors related to the parsing of parameters or options.

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