-
Type: Improvement
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: Attributes
-
None
-
Fully Compatible
Implementation plan:
- store BigDecimal values as Decimal128 (requires bson-4.14)
- when loading values, decode both Decimal128 and strings in the database to BigDecimal instances. This is always possible because BigDecimal has unlimited range and precision.
- both bson 4.14+ and bson 5 will be supported
- field type could be set to BSON::Decimal128 to avoid conversions to/from BigDecimal if it is desired to preserve Decimal128 types or to guarantee persistability since not every BigDecimal can be stored as Decimal128
Note that the data will be lazily converted to Decimal128 in the database upon saves.
Documentation
Migration guidance
Specify what happens when out of range BigDecimal is attempted to be persisted
Specify BSON::Decimal128 type explicitly to avoid converting to BigDecimal
- related to
-
MONGOID-4237 Support for Decimal128 type
- Closed
-
MONGOID-5213 Document changes to BigDecimal type and addition of global flag
- Closed