当前位置:网站首页>When should gridfs be used?

When should gridfs be used?

2022-06-24 09:34:00 Huang Jiajun

about MongoDB collection For documents under , At file greater than 16MB when , We should use GridFS.

In some solutions , Use MongoDB Of GridFS Store big files , More convenient than using a system level file system .

. When the directory of the file system has a limit on the number of files , You should use GridFS To store as many files as you need ;

. When you want your files and metadata to be automatically synchronized and deployed across multiple systems and facilities . Use geographically distributed replica sets (geographically distributed replica sets),MongoDB Files and metadata can be automatically distributed to multiple mongo Examples and facilities .

. When you want to access some information of a large file , When you don't want to load the entire file into memory , You can use GridFS Call back some files , Instead of reading the entire file into memory . If you need to automatically update the entire contents of the file , Do not use GridFS. As a substitute , You can store multiple versions of a file , And specify the current version of the file in the metadata . After uploading the new version of the file , You can express the update as an atomic update "latest" Metadata fields for , If necessary , You can delete the previous version .

原网站

版权声明
本文为[Huang Jiajun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206240812057865.html