0

I am in learning phase and I need an information, can anyone provide me an example to store video(binary data) sent from a mobile device and retrieve binary data using mongodb Gridfs and node.js. what will be the model and the datatype should I use to store binary data in mongodb and in node.js.

JN_newbie
  • 5,492
  • 14
  • 59
  • 97
  • @Neil What will be the model for it or should i say datatype. for e.g String, Number what will be the datatype should I use for storing video(binary data) – JN_newbie Mar 20 '15 at 06:08
  • There is no model. The GridFS spec will store binary and metadata independent of any mongoose models. The [duplicate question](http://stackoverflow.com/questions/20860005/storing-data-stream-from-post-request-in-gridfs-express-mongodb-node-js) has an answer with basic example usage and a link to a common plugin that handles everything for you. – Neil Lunn Mar 20 '15 at 06:11
  • @Neil Thanks, I will look into it. If any problem I will get back to you then. :) – JN_newbie Mar 20 '15 at 06:14
  • @Neil this link contains the info about storing an image but what about the storing the binary video? what should be the file name? as you have said also there will be no model or schema. I need an understanding about it. – JN_newbie Mar 21 '15 at 07:19
  • It's all binary data, that is what GridFS does, store binary data above 16MB. – Neil Lunn Mar 21 '15 at 07:47
  • @Neil ok I understand its all about binary, and probably I will use gridfs-stream but what is the fileName in createWriteStream? what will be in case of bytes when send from a device to the server? – JN_newbie Mar 23 '15 at 08:17

0 Answers0