Skip to content

Commit 6d39ad8

Browse files
authored
RUBY-2861 add documentation for the loss of trailing zeroes (#274)
* RUBY-2861 add docs for the loss of trailing zeroes * RUBY-2861 add note about future on Decimal128 * RUBY-2861 update language * RUBY-2861 update language
1 parent 0cab47e commit 6d39ad8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/tutorials/bson-v4.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,17 @@ follows:
543543
``BigDecimal`` is not. All signed ``NaN`` values that are deserialized into
544544
``BigDecimal`` instances will be unsigned.
545545

546+
- ``BSON::Decimal128`` maintains trailing zeroes when serializing to and
547+
deserializing from BSON. ``BigDecimal``, however, does not maintain trailing
548+
zeroes and therefore using ``BigDecimal`` may result in a lack of precision.
549+
550+
.. note::
551+
552+
In BSON 5.0, ``BSON::Decimal128`` will be deserialized into ``BigDecimal`` by
553+
default. In order to have ``BSON::Decimal128`` values in BSON documents
554+
deserialized into ``BSON::Decimal128``, the ``mode: :bson`` option can be set
555+
on ``from_bson``.
556+
546557
``Symbol``
547558
----------
548559

0 commit comments

Comments
 (0)