Skip to content

Commit eb8efc7

Browse files
author
Bob Grabar
committed
DOCS-655 review edits
1 parent 695e5d1 commit eb8efc7

File tree

1 file changed

+16
-23
lines changed

1 file changed

+16
-23
lines changed

source/applications/gridfs.txt

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ default GridFS limits chunk size to 256k. GridFS uses two collections to
1616
store files. One collection stores the file chunks, and the other stores
1717
file metadata.
1818

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.
2121
You also can access information from random sections of files, for
2222
example skipping into the middle of a video.
2323

@@ -46,10 +46,7 @@ To store and retrieve files using :term:`GridFS`, use either of the following:
4646
GridFS Collections
4747
------------------
4848

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:
5350

5451
- ``chunks`` stores the binary chunks. For details, see
5552
:ref:`gridfs-chunks-collection`.
@@ -64,22 +61,16 @@ bucket:
6461
- ``fs.files``
6562
- ``fs.chunks``
6663

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.
7266

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:
7570

76-
- ``photos.files``
77-
- ``photos.chunks``
71+
.. code-block:: javascript
7872

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()
8374

8475
.. index:: GridFS; chunks collection
8576
.. _gridfs-chunks-collection:
@@ -113,7 +104,7 @@ A document from the ``chunks`` collection contains the following fields:
113104

114105
.. data:: chunks.n
115106

116-
The sequential number of the chunk. Chunks are numbered in order,
107+
The sequence number of the chunk. Chunks are numbered in order,
117108
starting with 0.
118109

119110
.. data:: chunks.data
@@ -164,15 +155,17 @@ following fields. You can create additional fields:
164155
.. data:: files.chunkSize
165156

166157
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.
168159

169160
.. data:: files.uploadDate
170161

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.
172164

173165
.. data:: files.md5
174166

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.
176169

177170
.. data:: files.filename
178171

0 commit comments

Comments
 (0)