Josh Kim
Josh Kim

Reputation: 225

I want the benefits of GridFS but mainly storing files under 16MB

I need to create a storage system for files that will mostly be under 16MB but I want the benefits of GridFS like versioning, custom metadata, easy backup (with mongodump), etc. I'd say maybe 10% of my files would be over 16MB so I can't rely on storing in single documents, and I don't want to recreate the API for the benefits I'm looking for. I'm also already using a mongoDB system.

Should I use GridFS?

Upvotes: 6

Views: 2785

Answers (2)

WiredPrairie
WiredPrairie

Reputation: 59793

Without further details, I'd start by suggesting you read the recommendations provided here.

Given that all of your documents won't fit within the maximum document size when stored as a BSON document as BinData, I'd recommend using the gridFS system for a consistent programming and data management experience (for developers and IT). Depending on how the files are consumed, you may be able to more efficiently stream the contents of the files to clients when they are stored in GridFS by reading and writing in chunks.

Upvotes: 7

Vokinneberg
Vokinneberg

Reputation: 2017

It is recomended to store files smaller than 16 MB within single document using use the BinData data type for binary data. So, what is the problem to store files that size is under 16MB within single document and use GridFS only for files that size is exceed 16MB.

Upvotes: -1

Related Questions