MongoDB has a document size limit of 16MB. To store larger file sizes, it is recommended to use GridFS.
Now, if you are a meteor user, you can very easily use the Meteor Collection-FS package to store and upload files. But it is slightly different when you actually want to store an object of size larger than 16MB which is not a file. Usually, these scenarios will come in the server side when you generate a large content and want to store that.
I was doing something like this -
I found myself stuck with this error when I tried to use the insert function with the generated data.
DataMan constructor requires a type argument when passed a Buffer
This is actually a mistake in the documentation here - https://github.com/CollectionFS/Meteor-CollectionFS#initiate-the-upload which says the insert function accepts a Buffer object at the server side. It doesn’t. Issue raised here. It accepts a file object with its data set as a buffer object along with a mime type.
Here is how to get it done-
Now this will work :)
But we are not done yet !
How are we going to read the data back, if we are doing it at the client side ?
Any comments and feedback is most appreciated
Update (May 25th, 2016): I just saw that the author of the repo has stopped from maintaining the project. Sorry to hear it. Its still a great library and I hope will help users who might still use this.