mongoose db query data code example
Example 1: mongoose response to object
MyModel.findOne().lean().exec(function(err, doc) {
doc.addedProperty = 'foobar';
res.json(doc);
});
Example 2: query mongodb
db.inventory.find( { status: "D" } )
MyModel.findOne().lean().exec(function(err, doc) {
doc.addedProperty = 'foobar';
res.json(doc);
});
db.inventory.find( { status: "D" } )