Store files on mongodb database or server

72
July 26, 2022, at 05:30 AM

I have a website built on MongoDB which has files to be downloaded by users other than images ( it can be a software installer or .exe file .msi file or .blender file ) I mean different file formats.

How can you store such files on the server so that users can download them? As an example software companies have their software on servers that we as users can download. How do they store the on server if they use MongoDB?

Answer 1

MongoDB is in general document store , and it is best practice to store just a link in mongoDB , but keep the file content in file system, ftp , sftp, s3 , cloud object storage etc. If you anyway want to store files in mongoDB you can still do it , but you are facing the default max document size limit of 16MB so you need to use the special file storage API -> gridFS to overcome this limit for files bigger than 16MB.

Rent Charter Buses Company
READ ALSO
Best practices to handle Cart

Best practices to handle Cart

I am trying to create a E-commerce project using MERN stack and was wonderingHow to go about creating a cart for a user

103
Js Node Selenium Try-Catch Js Error not working

Js Node Selenium Try-Catch Js Error not working

I'm trying to simulate clicking on an element that is rendered after a certain iteration of documentreadyState='complete'

63
How to convert s3Object into File and send it inside a FormData on nodeJS?

How to convert s3Object into File and send it inside a FormData on nodeJS?

so I need to download a file from S3 bucket and then, with either its buffer or readStream, append it to a FormData on nodeI've tried different libraries such as formdata-node, isomorphic-form-data and form-data

86