-
Notifications
You must be signed in to change notification settings - Fork 1.7k
DOCS-656 - GridFS faq #417
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,6 +151,46 @@ flag to modify the file preallocation strategy. | |
|
||
.. seealso:: This wiki page that address :wiki:`MongoDB disk use <Excessive+Disk+Space>`. | ||
|
||
.. _faq-developers-when-to-use-gridfs: | ||
|
||
When should I use GridFS? | ||
------------------------- | ||
|
||
For documents in a MongoDB collection, you should always use | ||
:term:`GridFS` for storing files larger than 16 MB. | ||
|
||
For files on your file system, storing the files in a MongoDB database | ||
through GridFS provides advantages in a number of situations: | ||
|
||
- If your file system limits the number of files in a directory, you can | ||
use GridFS to store as many files as needed. | ||
|
||
- When you want to store file metadata (such as description, download | ||
count, and MD5 hash) together with the file itself. Storing the file | ||
data and metadata is important in many scenarios and supported by | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the meaning of "together" is vague here. I'd probably kill this bullet as it's not distinguishing, and I might move it down lower in the list regardless. in some sense, because metadata and content are in different collections, gridfs doesn't quite provide "storing metadata and data together," though that might be splitting hairs. |
||
GridFS. | ||
|
||
- When you want to keep your files and metadata automatically synced. | ||
If you set up replication, MongoDB replicates both the files and their | ||
metadata so things won't get out of sync. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this seems absurd as written becasue "synced" doesn't have an object so its more of a features without the corresponding usecase, which is weird.) The idea/approach should be more like: when you want to store files on systems in multiple data centers, you can use a gridfs store in combination with a replica set to ensure that each facility has a local (read) copy of all files that is always (roughly?) current. |
||
|
||
- When you want to access information from random sections of large | ||
files without having to load whole files into memory. GridFS lets you | ||
access sections of files without having to read the entire file. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add note about this being dependent on driver implementation. |
||
|
||
Do not use GridFS if a file is under the 16 MB limit and you need to | ||
update the file atomically. Instead, consider either: | ||
|
||
- Storing the file manually within a single document. This can be | ||
accomplished using the BSON BinData datatype. For details on using | ||
BinData, see the :doc:`drivers </applications/drivers>` documentation | ||
for your driver. | ||
|
||
- Storing multiple versions and specifying which version is current. | ||
This can be changed atomically after the new file is uploaded. | ||
|
||
For more information on GridFS, see :doc:`/applications/gridfs`. | ||
|
||
How does MongoDB address SQL or Query injection? | ||
------------------------------------------------ | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this sentence needs some help. the first use of filesystem is too ambiguous