I have a collection of documents with a value
property, I just want to multiply that by 0.75
and then .ceil()
it.
I'm trying with
Model.update({}, { $mul: { value: 0.75 }})
but then I don't know how to round it.
I've seen aggregate
allows to pipe operations but I don't understand if the output of aggregation is written in the DB or just returned, I need it to be updated in the DB.
Another solution would be to fetch all models, update them, and then save all of them but I don't know how to run a bulk save.
I have been pointed to this question but I don't see the relation since it's talking about referencing a property from inside the operation while I'm asking about how to round a property.