Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Mongo's Decimal128 data type #8840

Open
3 tasks done
JTPenn-EG opened this issue Dec 25, 2023 · 2 comments
Open
3 tasks done

Add support for Mongo's Decimal128 data type #8840

JTPenn-EG opened this issue Dec 25, 2023 · 2 comments
Labels
bounty:$20 Bounty applies for fixing this issue (Parse Bounty Program) type:feature New feature or improvement of existing feature

Comments

@JTPenn-EG
Copy link

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

Copy link

Thanks for opening this issue!

  • 🎉 We are excited about your ideas for improvement!

@mtrezza mtrezza added the type:feature New feature or improvement of existing feature label Dec 25, 2023
@mtrezza
Copy link
Member

mtrezza commented Dec 25, 2023

How would you imagine to implement this? With a new { __type: "decimal128", value: "..." }? And what should the type be called, bigdecimal, decimal128,..?

@mtrezza mtrezza added the bounty:$20 Bounty applies for fixing this issue (Parse Bounty Program) label Mar 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bounty:$20 Bounty applies for fixing this issue (Parse Bounty Program) type:feature New feature or improvement of existing feature
Projects
None yet
Development

No branches or pull requests

2 participants