Skip to content

Add support for Mongo's Decimal128 data type #8840

@JTPenn-EG

Description

@JTPenn-EG

New Feature / Enhancement Checklist

Current Limitation

Current Parse Server "Number" data type only supports numbers up to Mongo's double data type max value

Feature / Enhancement Description

Mongo 3.4 added support for Decimal128, adding support for it would allow servers to store numbers that they couldn't store before, all while keeping all query functions still working (afaik Decimal128 supports $gt, $gte, $lt, $lte, $eq, etc...)

Implementation I think would be very straightforward, the problem with this data type that it's not natively supported in all SDKs, so Parse Server would probably need to send the Decimal128 as a string in the Response and the SDK would need to convert the string back to a BigDecimal class (probably available in all languages)

Another problem is to find another alternative for Postgres, but I am no expert in Postgres so idk..

Example Use Case

I think any app that deals with monetary values need this data type, most blockchains use uint256 (max value of 2^256-1) for value representation...

Alternatives / Workarounds

You can store big numbers using strings right now, but that doesn't support number specific query functions...

References

https://www.mongodb.com/developer/products/mongodb/bson-data-types-decimal128/
https://github.com/iriscouch/bigdecimal.js/tree/master
https://pub.dev/packages/decimal

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions