From what I've read it is recommended to store anything under 16 MB in a document and anything above in GridFS. Okay fine. My question is what is the best way to do that?
My application can process hundreds of files concurrently and the files can be of all sizes, for example 1K to 100GB (or more). The majority will be under 16MB, but I don't want to read the entire input stream into a big byte array and then set an attribute on a document with the byte array and store the document. That can create a ton of overhead for us.
I want to be able to store the document, but stream the input stream into the document and in reverse stream the document over to a input stream.
Anyone have suggestions?