I making a social website with mern stack. I try, user media file in mongodb with base64 string but problem is that it is large.where can i store user media files like image, video etc.
I making a social website with mern stack. I try, user media file in mongodb with base64 string but problem is that it is large.where can i store user media files like image, video etc.
2
Answers
First of all, storing BLOB (image is one of them) in DB is a really bad practice and I’m glad people are noticing it as they go down the road.
A common practice is storing files in a file system and then storing the file path in the DB.
If you are using online services, then you may consider using an image CDN instead and storing the URL in the DB.
I would recommend Cloudinary. Not only will you be able to store your videos but you’ll be able to manipulate and reduce the size of your assets without compromising on their quality. 😊 The good news is it’s free to get started