@@ -528,29 +528,29 @@ BSON::Decimal128 vs BigDecimal
528
528
The ``BigDecimal`` ``from_bson`` and ``to_bson`` methods use the same
529
529
``BSON::Decimal128`` methods under the hood. This leads to some limitations
530
530
that are imposed on the ``BigDecimal`` values that can be serialized to BSON
531
- and those that can be deserialized from existing ``BSON::Decimal128 `` BSON
532
- objects . This change was made because serializing ``BigDecimal`` instances as
531
+ and those that can be deserialized from existing ``decimal128 `` BSON
532
+ values . This change was made because serializing ``BigDecimal`` instances as
533
533
``BSON::Decimal128`` instances allows for more flexibility in terms of querying
534
534
and aggregation in MongoDB. The limitations imposed on ``BigDecimal`` are as
535
535
follows:
536
536
537
- - ``BSON::Decimal128 `` has a limited range and precision, while ``BigDecimal``
538
- has no restrictions in terms of range and precision. ``BSON::Decimal128 `` has
539
- a max value of approximately ``10^6145`` and a min value of approximately
540
- ``-10^6145``, and has a maximum of 34 bits of precision.
537
+ - ``decimal128 `` has a limited range and precision, while ``BigDecimal`` has no
538
+ restrictions in terms of range and precision. ``decimal128 `` has a max value
539
+ of approximately ``10^6145`` and a min value of approximately ``-10^6145``,
540
+ and has a maximum of 34 bits of precision.
541
541
542
- - ``BSON::Decimal128 `` is able to accept signed ``NaN`` values, while
543
- ``BigDecimal`` is not. All signed ``NaN`` values that are deserialized into
544
- ``BigDecimal`` instances will be unsigned.
542
+ - ``decimal128 `` is able to accept signed ``NaN`` values, while ``BigDecimal``
543
+ is not. All signed ``NaN`` values that are deserialized into ``BigDecimal``
544
+ instances will be unsigned.
545
545
546
- - ``BSON::Decimal128 `` maintains trailing zeroes when serializing to and
546
+ - ``decimal128 `` maintains trailing zeroes when serializing to and
547
547
deserializing from BSON. ``BigDecimal``, however, does not maintain trailing
548
548
zeroes and therefore using ``BigDecimal`` may result in a lack of precision.
549
549
550
550
.. note::
551
551
552
- In BSON 5.0, ``BSON::Decimal128 `` is deserialized into ``BigDecimal`` by
553
- default. In order to have ``BSON::Decimal128 `` values in BSON documents
552
+ In BSON 5.0, ``decimal128 `` will be deserialized into ``BigDecimal`` by
553
+ default. In order to have ``decimal128 `` values in BSON documents
554
554
deserialized into ``BSON::Decimal128``, the ``mode: :bson`` option can be set
555
555
on ``from_bson``.
556
556
0 commit comments