From 35d0c633c78dd833c7827743fc3b957cbfb4c9ef Mon Sep 17 00:00:00 2001 From: Jamis Buck Date: Thu, 24 Aug 2023 15:44:26 -0600 Subject: [PATCH] Prep for v8.0.6 (#5682) * version bump * add release notes for the `allow_bson5_decimal128` config option * don't use docker due to rate limiting --- .evergreen/config.yml | 2 +- .evergreen/config/commands.yml.erb | 2 +- docs/release-notes/mongoid-8.0.txt | 37 ++++++++++++++++++++++++++++++ lib/mongoid/version.rb | 2 +- 4 files changed, 40 insertions(+), 3 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 3a7b98985d..0f734bc039 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -282,7 +282,7 @@ functions: DRIVER="${DRIVER}" \ I18N="${I18N}" \ TEST_I18N_FALLBACKS="${TEST_I18N_FALLBACKS}" \ - ./egos .evergreen/run-tests-docker.sh + ./egos .evergreen/run-tests.sh "fix absolute paths": - command: shell.exec diff --git a/.evergreen/config/commands.yml.erb b/.evergreen/config/commands.yml.erb index 9cc142fddf..311c3bfe0b 100644 --- a/.evergreen/config/commands.yml.erb +++ b/.evergreen/config/commands.yml.erb @@ -256,7 +256,7 @@ functions: DRIVER="${DRIVER}" \ I18N="${I18N}" \ TEST_I18N_FALLBACKS="${TEST_I18N_FALLBACKS}" \ - ./egos .evergreen/run-tests-docker.sh + ./egos .evergreen/run-tests.sh "fix absolute paths": - command: shell.exec diff --git a/docs/release-notes/mongoid-8.0.txt b/docs/release-notes/mongoid-8.0.txt index c9251c7fb8..a056876672 100644 --- a/docs/release-notes/mongoid-8.0.txt +++ b/docs/release-notes/mongoid-8.0.txt @@ -767,3 +767,40 @@ Support for individually caching criteria objects has been dropped in Mongoid 8. In order to get caching functionality, enable the Mongoid Query Cache. See the section on :ref:`Query Cache ` for more details. + + +BSON 5 and BSON::Decimal128 Fields +---------------------------------- + +When BSON 4 or earlier is present, any field declared as BSON::Decimal128 will +return a BSON::Decimal128 value. When BSON 5 is present, however, any field +declared as BSON::Decimal128 will return a BigDecimal value by default. + +.. code-block:: ruby + + class Model + include Mongoid::Document + + field :decimal_field, type: BSON::Decimal128 + end + + # under BSON <= 4 + Model.first.decimal_field.class #=> BSON::Decimal128 + + # under BSON >= 5 + Model.first.decimal_field.class #=> BigDecimal + +If you need literal BSON::Decimal128 values with BSON 5, you may instruct +Mongoid to allow literal BSON::Decimal128 fields: + +.. code-block:: ruby + + Model.first.decimal_field.class #=> BigDecimal + + Mongoid.allow_bson5_decimal128 = true + Model.first.decimal_field.class #=> BSON::Decimal128 + +.. note:: + + The ``allow_bson5_decimal128`` option only has any effect under + BSON 5 and later. BSON 4 and earlier ignore the setting entirely. diff --git a/lib/mongoid/version.rb b/lib/mongoid/version.rb index c147284689..6f75c3de88 100644 --- a/lib/mongoid/version.rb +++ b/lib/mongoid/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Mongoid - VERSION = "8.0.5" + VERSION = "8.0.6" end