How to round to 2 decimal places without aggregation or use array filters with aggregation

I need to update a number that is in an object nested on an array of the document collection, I don’t want to use the aggregation pipeline since I cannot use arrayFilters with it and don’t want to update all the objects of the array cause is not needed, the problem is with the language that there is some inaccuracies when working with decimals and my app is a financial one that needs more accurate results in the order of 2 decimal places, I see some people that say to solve this client side, but several people can update the same document so can be error prone, how can I round to 2 decimal places without aggregation or use array filters with aggregation to update just the object that is needed to update?

Could you work with integers instead of reals: in cents instead of euros (of dollars)

thanks for your reply, sorry but I don’t understand

With $map in an aggregation pipeline you do not update all the objects of an array since with $cond you simply return $this for elements that do not need to be updated.

To help you further we will need samples documents and expected results. What ever you tried together with how it fails is helpful for us to know.

And finally, $convert would be the way to convert your amounts.