LiranC LiranC - 5 months ago 32
Node.js Question

saving Images displayed on HTML as Data URI in mongoose/node.js

i am generating images in Data uri form, and want to store them into mongoose.
i am using node.js
it looks like that, just to be clear:

<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgAAAQABAAD/7QCcUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAIAcAmcAFHp2ektFZEgzQ1p1eHluWFMtZklQHAIoA ... />


what is the correct mongoose schema type to store such a data type? and there is any example available i will be glad

Answer

That's just a String, so use a String type.

var myschema = new Schema({ dataUri : String });