I want to update price
field to 0.5 * price
using mongoose.
what i tried (and works) is finding items, changing them and saving them. but is there any more efficient(better performance) way?
Products.find({} ,
(err, ps) => {
ps.forEach(p => {
p.Price = p.Price * 0.5;
p.save((err, res) => console.log(err, res))
});
}
)
Note that i know how to do this in mongodb (link), but i don't know how to do this in mongoose.