Im very new to databases so sorry if thats a stupid question, but I would like to use a NoSQL database to store assets for 3d projects, and those files can get big. So is there a way to store files in MongoDB and if so, what file sizes can it handle?
If it was answered somewhere else please link me to it, I could not find it via search.
Thanks for your time!
Hi Patrick, welcome to the community!
Storing large files in a database is always a contentious topic, but I’ll skip over that.
As you’ve likely discovered, there is a 16 MB size limit for MongoDB documents. If you need to store files larger than that then you can use GridFS.
I am interested in different point of views in relation to the above as I want to start experimenting with GridFS. Do you have some links you could share? Thanks
Hopefully others will chip in, but from my perspective.
Storing a large number of big files in a database is expensive in terms of local storage and memory. Storing the files in your local file system (and then including a reference to it in your documents) is one option. If you can afford the network latency then offloading the files to cheap block storage such as S3 is a great option.
Having said that, there are occasions where storing a modest number of modest-sized files in the database can make sense. As an example, I have an app where the MongoDB data is synced to a Realm database running inside a mobile app. I want some thumbnail images to always be up to date and available in the mobile app - even when offline (the app is designed to be used out at sea). By storing those thumbnails in MongoDBgoDB, MongoDB Realm Sync makes sure that they’re always available locally in the mobile app (where an S3 link would be useless when there’s no cell coverage.)
As always, it depends on the characteristics of your data and app.
Thanks that’s exactly the kind of feedback I am interested.
I too hope so.
In my case, I have some backup sharing functionalities that I want to migrate out of Dropbox. GridFS with Atlas could be use as an alternative. It would make sense as other parts are already using Atlas. The goal is not to store the files permanently on GridFS but to use it as transient transport mechanism. But more importantly to unify how the database is backed up with the other files.
Thanks for the input guys. I wanted to save my files in a database, so I do not have to worry about breaking links to the programs they are connected to when I decide to restructure something. But from you answers it seems it is not the best idea. I will have a look at GridFS, maybe I will store only the smaller files let’s say up to 100mb. Some type of assets like textures will probably never exceed this limit. Again, thanks for your time!