I am using Mongo-Java Driver 2.13. I want to store pdf Files of varying size ( 1mb to 30mb).
Note: I know I can't store a document having size greater than 16mb in
MongoDB. Then, I need to use GridFS. Also, I need to get whole pdf at a time not chunks.
I want to save pdf Files of small size(<16 mb) in a collection (say BookPdf) in normal way. For larger files, I need to store it using GridFS(in fs.chunks and fs.files). When I want to retrieve all pdf Files, it need to access BookPdf collection and fs.chunks, fs.files collections. It will loose atomicity for that find operation and also, it will take much time to get data from different collections.
What should be the best way:
Save all of my data in GridFS.
Save data in different collections according to size.
Any other approach?
Thanks in advance,
Devender
Save all of my data in GridFS.