I'm want to round off to 2 decimal places.
I'm using it in 2 places, one is in the aggregate query, using $round which I understood that it works in the following way: Ex: {$round : [46.305, 2]} => 46.3 So basically it is getting the 3rd digit after the decimal and only for digits 6 and greater, it is rounding off to next digit. That is, in 46.305, 3rd digit after the decimal is 5 which is less than 6. Hence rounding off to 46.3
In another query, I'm using Math.round(). Ex: Math.round(46.305 * 100)/100 => 46.31. Because it is considering from .5 and greater and rounding off to next digit.
So here I'm getting conflicts in the values
Aggregate is returning 46.3 and math.round() is giving 46.31
Ideally, I want to round off to 2 digits and want to have the same values in both cases.