Good Morning. I need to store and save pdf and doc documents. Which is the best option? Thank you
Good Morning @francisco_jose, welcome to MongoDB forum.
In MongoDB, you use GridFS for storing files larger than 16 MB.
If the files (i.e., each of them) to be stored are within the 16 MB limit of BSON document size, then you can store the files within a collection’s document as a field of type Binary Data (
Thanks for quick reply. Still separate the data into two custer? One for data related to pdf and the other for pdf? Best regards
What are you considering - GridFS or within a document? What is the maximum size of the PDF documents?
In case of GridFS, the file and its information is stored in two collections (the
chunks collections). The
files stores the file’s metadata (information about the file like, id, length / size, filename, content type, etc.) and the
chunks stores the actual file data.
In case of a document as a file store, you can have additional fields specifying the file name, description etc., that is within the same document of the collection.
I tried importing pdf files to gridfs. As everything is stored in BSON, is it possible to export the pdf file from mongodb which I imported ?
Thank you. mongofiles command works
can you please provide a link that explains how to store the file (the functions) and then display it to the user from the DB.