Support sum decimal type of values in $sum operator by lxy1992 · Pull Request #618 · mongomock/mongomock
This PR add the support for the decimal value in $sum operator with UTs
Behavior:
- any value in the list of
$sumoperator isdecimal128.Decimal, the result of sum will bedecimal128.Decimal128.
The mongo support all types in numbers.Number, the decimal is one of them. However, the real type of decimal mongo store in the disk is decimal128.Decimal128, which is not supported by the sum function in Python. So, I convert them to decimal.Decimal before sum, revert the type of result when return.
Looking forwarding to code review.
Cheers!