@@ -16,8 +16,8 @@ default GridFS limits chunk size to 256k. GridFS uses two collections to
16
16
store files. One collection stores the file chunks, and the other stores
17
17
file metadata.
18
18
19
- When you query for a file stored through GridFS, GridFS sends the chunks
20
- as a data stream . You can perform range queries on files stored through GridFS.
19
+ When you query for a file stored through GridFS, GridFS reassembles the chunks
20
+ as needed . You can perform range queries on files stored through GridFS.
21
21
You also can access information from random sections of files, for
22
22
example skipping into the middle of a video.
23
23
@@ -46,10 +46,7 @@ To store and retrieve files using :term:`GridFS`, use either of the following:
46
46
GridFS Collections
47
47
------------------
48
48
49
- :term:`GridFS` stores files in two collections but makes it appear you
50
- have created a single collection.
51
-
52
- Under the hood, GridFS uses two collections to store files:
49
+ :term:`GridFS` stores files in two collections:
53
50
54
51
- ``chunks`` stores the binary chunks. For details, see
55
52
:ref:`gridfs-chunks-collection`.
@@ -64,22 +61,16 @@ bucket:
64
61
- ``fs.files``
65
62
- ``fs.chunks``
66
63
67
- You can rename the ``fs`` bucket, as well as create additional buckets.
68
-
69
- GridFS uses the bucket name to make it appear that you have created a
70
- single collection. When you access the files, you use the bucket name as
71
- though it were the name of the collection.
64
+ You can choose a different default bucket name than ``fs``, as well as
65
+ create additional buckets.
72
66
73
- For example, if you use GridFS to create a ``photos`` collection, GridFS
74
- actually creates these two collections:
67
+ To access files, you use the bucket name. For example, if you use GridFS
68
+ to create a ``photos`` bucket, then to issue the :method:`findOne()
69
+ <db.collection.findOne()>` command from the :program:`mongo` shell you would type:
75
70
76
- - ``photos.files``
77
- - ``photos.chunks``
71
+ .. code-block:: javascript
78
72
79
- If you save a new 20 MB photo into the ``photos`` collection, GridFS
80
- records metadata about the photo in ``photos.files`` and divides the
81
- photo's binary data into chunks for storage in the ``photos.chunks``
82
- collection.
73
+ db.photos.findOne()
83
74
84
75
.. index:: GridFS; chunks collection
85
76
.. _gridfs-chunks-collection:
@@ -113,7 +104,7 @@ A document from the ``chunks`` collection contains the following fields:
113
104
114
105
.. data:: chunks.n
115
106
116
- The sequential number of the chunk. Chunks are numbered in order,
107
+ The sequence number of the chunk. Chunks are numbered in order,
117
108
starting with 0.
118
109
119
110
.. data:: chunks.data
@@ -164,15 +155,17 @@ following fields. You can create additional fields:
164
155
.. data:: files.chunkSize
165
156
166
157
The size of each chunk. GridFS divides the document into chunks of
167
- the size specified here. The default size is 256k .
158
+ the size specified here. The default size is 256 kilobytes .
168
159
169
160
.. data:: files.uploadDate
170
161
171
- The date the document was first stored by GridFS.
162
+ The date the document was first stored by GridFS. This value has the
163
+ ``Date`` data type.
172
164
173
165
.. data:: files.md5
174
166
175
- An MD5 hash returned from the filemd5 api.
167
+ An MD5 hash returned from the filemd5 API. This value has the ``String``
168
+ data type.
176
169
177
170
.. data:: files.filename
178
171
0 commit comments