1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
============================
MongoDB\\GridFS\Bucket Class
============================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpclass:: MongoDB\\GridFS\\Bucket
:manual:`GridFS </core/gridfs>` is a specification for storing and retrieving
files in MongoDB. GridFS uses two collections to store files. One collection
stores the file chunks (e.g. ``fs.chunks``), and the other stores file
metadata (e.g. ``fs.files``). The :phpclass:`MongoDB\\GridFS\\Bucket` class
provides an interface around these collections for working with the files as
PHP :php:`Streams <stream>`.
You can construct a GridFS bucket using the driver's
:php:`Manager <class.mongodb-driver-manager>` class, or select a bucket from
the library's :phpclass:`MongoDB\\Database` class via the
:phpmethod:`selectGridFSBucket() <MongoDB\\Database::selectGridFSBucket>`
method.
Methods
-------
.. toctree::
:titlesonly:
/reference/method/MongoDBGridFSBucket__construct
/reference/method/MongoDBGridFSBucket-delete
/reference/method/MongoDBGridFSBucket-downloadToStream
/reference/method/MongoDBGridFSBucket-downloadToStreamByName
/reference/method/MongoDBGridFSBucket-drop
/reference/method/MongoDBGridFSBucket-find
/reference/method/MongoDBGridFSBucket-findOne
/reference/method/MongoDBGridFSBucket-getBucketName
/reference/method/MongoDBGridFSBucket-getDatabaseName
/reference/method/MongoDBGridFSBucket-getFileDocumentForStream
/reference/method/MongoDBGridFSBucket-getFileIdForStream
/reference/method/MongoDBGridFSBucket-openDownloadStream
/reference/method/MongoDBGridFSBucket-openDownloadStreamByName
/reference/method/MongoDBGridFSBucket-openUploadStream
/reference/method/MongoDBGridFSBucket-rename
/reference/method/MongoDBGridFSBucket-uploadFromStream