Skip to content

Commit 06f13b0

Browse files
authored
MONGOID-5381 Correct map_big_decimal_to_decimal128 feature flag default and write 8.0 release note (#5338)
* MONGOID-5381 add BigDecimal release notes * MONGOID-5381 change the default for feature flag * MONGOID-5381 remove unused code * MONGOID-5381 fix failing test * MONGOID-5381 flip flag * MONGOID-5381 adjust release note
1 parent d5e6c20 commit 06f13b0

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

source/reference/configuration.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,8 @@ for details on driver options.
397397
log_level: :info
398398

399399
# When using the BigDecimal field type, store the value in the database
400-
# as a BSON::Decimal128 instead of a string. (default: false)
401-
map_big_decimal_to_decimal128: false
400+
# as a BSON::Decimal128 instead of a string. (default: true)
401+
#map_big_decimal_to_decimal128: true
402402

403403
# Force ``BSON::ObjectId#as_json`` method to return the hash
404404
# { "$oid" => id.to_s }. When this option is false, and bson-ruby 5

source/reference/fields.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,8 @@ matches strings containing "hello" before a newline, besides strings ending in
428428
This is because the meaning of ``$`` is different between PCRE and Ruby
429429
regular expressions.
430430

431+
.. _bigdecimal-fields:
432+
431433
BigDecimal Fields
432434
-----------------
433435

source/release-notes/mongoid-8.0.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ changed in Mongoid 8.0:
4040
- ``:legacy_attributes`` => true
4141
- ``:legacy_pluck_distinct`` => ``false``
4242
- ``:legacy_triple_equals`` => ``false``
43-
- ``:map_big_decimal_to_decimal128`` => ``true``
4443
- ``:object_id_as_json_oid`` => ``false``
4544
- ``:overwrite_chained_operators`` => ``false``
4645

@@ -472,3 +471,17 @@ it was stored and returned as a String.
472471
p registry.data
473472
# => Mongoid 7: "data!"
474473
# => Mongoid 8: <BSON::Binary:0x2600 type=generic data=0x6461746121...>
474+
475+
``Decimal128``-backed ``BigDecimal`` fields
476+
-------------------------------------------
477+
478+
Mongoid 8 introduces the ``map_big_decimal_to_decimal128`` feature flag, which
479+
allows values assigned to a field of type ``BigDecimal`` to be stored as type
480+
``String`` in the database for compatibility with Mongoid 7 and earlier. In
481+
Mongoid 8 by default (with this feature flag turned on), values assigned to
482+
fields of type ``BigDecimal`` are stored in the database as type
483+
``BSON::Decimal128``. In Mongoid 7 and earlier, and in Mongoid 8 with this
484+
feature flag turned off, values assigned to fields of type ``BigDecimal`` are
485+
stored as Strings. See the section on :ref:`BigDecimal Fields <bigdecimal-fields>`
486+
for more details.
487+

0 commit comments

Comments
 (0)