It's update only false to true not working for true to false. I'm using node.js mongodb and express.js
This is My schema:
approve:{
type: Boolean, default: false
}
index.js
.post('/update', function(req, res, next) {
var id = req.body.id;
var value = req.value;
console.log(req.body);
var update_stock = stmodel.findByIdAndUpdate(id, { $set: { approve: "value" } });
update_stock.exec(function(err, doc) {
if (err) throw err;
});