Skip to content

DOCS-5204: clarify GridFS behavior for small files #2488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 16 MB.

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 255 KB. 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