MongoDB Guide (translated) (16)-developer zone-when to use gridfs

Source: Internet
Author: User
Tags mongodb version

When to use GridFS

  • A large number of files. GirdFS performs better than many file systems when processing large (several thousand) files.
  • Files uploaded by the user. When a user uploads a file, you may have a large number of files and want to copy them and back up them. GridFS is an ideal way to save them, so you can manage these files as you want to manage common data. You can also use the keyword user to wait for the upload time to be directly queried in the data warehouse without passing through the indirect layer.
  • Files that are frequently changed. If you have some files that will change frequently-it makes sense to store them in GridFS, so that you can modify them in one place, and then all clients will obtain these updates. It is better than storing it in the directory tree, so that you do not need to deploy applications to update files.

When to disable GridFS

  • A small number of unchanged files. If you have small files (js, css, and images) on some websites, it may be easier to directly use the file system.
  • If you need to perform atomic update on binary objects, and the object size is limited by the Mongodb version you use (the 1.8 version is 16 MB ), you can save the object in a single document. This can be done using the BSON binary type. Find detailed information about this type in your driver documentation.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.