Skip to content

Commit

Permalink
DOCS-5204 clarify gridfs behavior for small files
Browse files Browse the repository at this point in the history
Clarifies the behavior of GridFS when storing files that are smaller than the
default chunk size.

Signed-off-by: kay <kay.kim@10gen.com>
  • Loading branch information
ksuarz authored and kay-kim committed Dec 22, 2015
1 parent a68ab75 commit d5af2bf
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions source/core/gridfs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,21 @@ that exceed the :term:`BSON`\-document :ref:`size limit
<limit-bson-document-size>` of 16MB.

Instead of storing a file in a single document, GridFS divides a file
into parts, or chunks, [#chunk-disambiguation]_ and stores each of
those chunks as a separate document. By default GridFS limits chunk
size to 255k. GridFS uses two collections to store files. One
collection stores the file chunks, and the other stores file metadata.
into parts, or chunks [#chunk-disambiguation]_, and stores each chunk as
a separate document. By default, GridFS uses a chunk size of 255 KB;
that is, GridFS divides a file into chunks of 255 KB with the exception
of the last chunk. The last chunk is only as large as necessary.
Similarly, files that are no larger than the chunk size only have a
final chunk, using only as much space as needed plus some additional
metadata.

GridFS uses two collections to store files. One collection stores the
file chunks, and the other stores file metadata. For more information,
refer to :ref:`gridfs-collections`.

When you query a GridFS store for a file, the driver or client will
reassemble the chunks as needed. You can perform range queries on
files stored through GridFS. You also can access information from
files stored through GridFS. You also can access information from
arbitrary sections of files, which allows you to "skip" into the
middle of a video or audio file.

Expand Down Expand Up @@ -48,6 +55,8 @@ To store and retrieve files using :term:`GridFS`, use either of the following:
- The :program:`mongofiles` command-line tool in the :program:`mongo`
shell. See the :program:`mongofiles` reference for complete documentation.

.. _gridfs-collections:

GridFS Collections
------------------

Expand Down

0 comments on commit d5af2bf

Please sign in to comment.