For example, I have a Scheme like this:
var User_schema = new Schema({
name: string,
image:{
avartar_image: String,
thumbnai_image: String,
story_image: String
}
});
Is it possible to create one field have many value like that in nodejs and mongoose? And one more, how can I store the image into mongodb and can push back to client using mongoose?, I store image on mongodb with Buffer, like this :
var Imgschema = new Schema({
img: Buffer;
});
And if send it to the user when user request a link on server, I do like this:
app.get('/', function (req, res, next) {
Imgschema.findById('5cdnjwjadhad_ad14', function (err, object) {
res.contentType('image/png');
res.send(object.image, {imageToClient: object.image});
});
});
It will send the image to the user with full screen, but I want the image display inside the tag with view engine, something like this:
<img src="{{imageToClient}}">
Any one help please, Thanks.