Releases: mongodb/mongoid
9.0.3
Version 9.0.3 of the Mongoid ODM for MongoDB is now available.
Release Highlights
This patch release adds support for Ruby 3.3 and Rails 8 to Mongoid 9.0.
Documentation
Documentation is available at MongoDB.com.
Installation
You may install this version via RubyGems, with:
gem install --version 9.0.3 mongoid
What's Changed
- MONGOID-5757 Fix validation checks so that all associated records are validated by @jamis in #5882
- MONGOID-5819 Do not pass the :database option when creating a client by @jamis in #5890
- MONGOID-5823 Use proper thread-local variables instead of fiber-local variables by @jamis in #5896
- MONGOID-5818 Support Rails 8 (#5876) by @comandeo-mongo in #5898
Full Changelog: v9.0.2...v9.0.3
8.1.7
Version 8.1.7 of the Mongoid ODM for MongoDB is now available.
Release Highlights
This patch release adds support for Ruby 3.3 and Rails 8 to Mongoid 8.1.
Documentation
Documentation is available at MongoDB.com.
Installation
You may install this version via RubyGems, with:
gem install --version 8.1.7 mongoid
What's Changed
- MONGOID-5805 Short-circuit the logic in extract_attribute to fix performance regression by @jamis in #5869
- MONGOID-5757 Fix validation checks so that all associated records are validated by @jamis in #5883
- MONGOID-5818 Support Rails 8 by @comandeo-mongo in #5897
Full Changelog: v8.1.6...v8.1.7
9.0.2
Version 9.0.2 of the Mongoid ODM for MongoDB is now available.
Release Highlights
This patch release adds support for Rails 7.2. It also adds support for custom polymorphic types, and includes bug fixes.
Documentation
Documentation is available at MongoDB.com.
Installation
You may install this version via RubyGems, with:
gem install --version 9.0.2 mongoid
What's Changed
- MONGOID-5734 Custom polymorphic types by @jamis in #5845
- MONGOID-5797 Fix accessing parent when projected by @comandeo-mongo in #5847
- MONGOID-5806 Rails 7.2 Support by @AlexKovynev in #5852
- MONGOID-5808 Fix collection_options in store_in by @comandeo-mongo in #5859
New Contributors
- @AlexKovynev made their first contribution in #5852
Full Changelog: v9.0.1...v9.0.2
8.1.6
Version 8.1.6 of the Mongoid ODM for MongoDB is now available.
Release Highlights
- MONGOID-5806: Rails 7.2 support.
- MONGOID-5769: Fix error with the
$pull
and$pop
operators not being handled correctly byupdateAll
. - MONGOID-5789: Fix behavior when requesting an attribute with
nil
as the name. Previously raised a spurious exception, now returns an empty string. - MONGOID-5797: When using a projection on a model with an
embeds_many
relation, accessing the inverse (parent) relation was failing. This has been fixed.
Documentation
Documentation is available at MongoDB.com.
Installation
You may install this version via RubyGems, with:
gem install --version 8.1.6 mongoid
What's Changed
- DOCSP-37327: Fix table format (#5798) by @norareidy in #5800
- Mongoize is not called on update_all, when $set operator is used by @dem in #5815
- DOCSP-38361 - Add text to empty pages (#5826) by @jamis in #5827
- MONGOID-5789 Allow nil attribute access (backport of #5836) by @jamis in #5838
- MONGOID-5797 Fix accessing parent when projected (#5847) by @comandeo-mongo in #5849
- Fix mongoize update all array operators 8.1 by @JohnMaguir in #5824
- MONGOID-5806 Rails 7.2 Support (#5852) by @comandeo-mongo in #5860
- MONGOID-5793 Backport SSDLC changes from master by @jamis in #5865
- Prepare 8.1.6 release by @comandeo-mongo in #5864
- Prep for 8.1.6 by @jamis in #5867
Full Changelog: v8.1.5...v8.1.6
9.0.1
Version 9.0.1 of the Mongoid ODM for MongoDB is now available.
Release Highlights
- MONGOID-5786: In accordance with Ruby's enumerable API, the #sum method now accepts an optional block. Thank you to Cristián Pérez for your contributions!
- MONGOID-5688: Problematic recursive callstacks in cascading callbacks have been linearized using Ruby Fibers to prevent SystemStackErrors with greater numbers of embedded documents. Thank you to Adviti Mishra for your contributions!
- MONGOID-5769: $pop and $pull are now mongoized the same way as #addToSet or $push to ensure update_all functions as intended. Thank you to John Maguir and Michael Deryugin for your contributions!
- MONGOID-5789: querying an attribute with a nil name now returns an empty string, rather than raising an exception. Thank you to Dan Healy for your contribution!
- MONGOID-5785: if you set Mongoid.allow_scopes_to_unset_default_scope = true, you can invoke (e.g.) unscoped in a named scope to reset the current scope. This is useful for overriding default scopes inside of a named scope. This option will default to true in Mongoid 10.
- MONGOID-5791: If the parent document class is not loaded at the time of loading the embedded document class, a NameError used to be raised. This has been fixed.
- MONGOID-5796: The docs previously present in the Mongoid repository have been moved to the docs-mongoid repository.
Documentation
Documentation is available at MongoDB.com.
Installation
You may install this version via RubyGems, with:
gem install --version 9.0.1 mongoid
What's Changed
- Mongoize is not called on update_all, when $set operator is used by @dem in #5814
- Fix mongoize update all array operators master by @JohnMaguir in #5823
- DOCSP-38361 - Add text to empty pages by @mongoKart in #5826
- MONGOID-5508 touch on custom field by @adviti-mishra in #5829
- RUBY-3489: Add empty SBOM lite file by @alcaeus in #5830
- MONGOID-5786: Fix some compatibility issues with Enumerable API by @cperezabo in #5831
- MONGOID-5785 allow named scopes to remove a default scope by @jamis in #5832
- MONGOID-5743 SSDLC Requirements by @jamis in #5834
- MONGOID-5789 database_field_name given nil or empty string should raise UnknownAttribute exception by @danhealy in #5836
- DOP-4809: Remove docs/ since it has been migrated to mongodb/docs-mongoid by @i80and in #5840
- MONGOID-5790 MONGOID-5791 Fix error caused by loading a referenced class prematurely by @jamis in #5839
- Modified the comment to rightly indicate the error being raised is In… by @adviti-mishra in #5841
- 5688: Run callbacks for children within fibers by @adviti-mishra in #5837
- Added a pointer to docs-mongoid in the README.md by @adviti-mishra in #5843
New Contributors
- @mongoKart made their first contribution in #5826
- @adviti-mishra made their first contribution in #5829
- @cperezabo made their first contribution in #5831
- @danhealy made their first contribution in #5836
- @i80and made their first contribution in #5840
Full Changelog: v9.0.0...v9.0.1
Mongoid 9.0
Mongoid 9.0 is a new major update to the Mongoid ODM. It includes many bug fixes, updates, improvements, and new features.
Significant new features include the following:
- You can now create and manage Atlas search indexes directly from Mongoid, by specifying your search index definitions directly on the relevant models. (MONGOID-5601)
- You can now declare a transaction with a block, using syntax that should be familiar to Rails programmers. (You must still be using a MongoDB topology that supports transactions, like a replica-set or sharded topology.) Along with this new syntax, support has also been added for
after_commit
andafter_rollback
callbacks. (MONGOID-5530, MONGOID-5531 and MONGOID-5708) - Around callbacks on embedded documents are now disabled by default, for performance reasons. If a parent document has a large number (hundreds) of embedded documents, it is possible for the stack to be exhausted while processing "around" callbacks for those embedded documents. If you need around callbacks for your embedded documents, and you are confident that you will not have large numbers of embedded documents in a single parent, you can enable around callbacks with the
Mongoid.around_embedded_document_callbacks
configuration option. (MONGOID-5658) - A new serializer has been added to allow
BSON::ObjectId
instances to be serialized and deserialized by ActiveJob. (MONGOID-5611) - If you specify custom storage options when loading a model (e.g. overriding its collection name, database name, or the named client), you will not need to explicitly specify those same options when saving the model. The model will remember the storage options that were active when it was loaded. (MONGOID-5472)
- Support for "sandbox mode" in the Rails console has been added. As long as you are using a supported topology (replica-set or sharded, for example), when you specify
--sandbox
when starting the Rails console, your console session will be wrapped in a transaction. (MONGOID-4901) - You can now enjoy Client-Side Field Level Encryption (CSFLE) in Mongoid with supported database server versions. Declare your CSFLE schemas in your documents, configure your encryption in
mongoid.yml
orconfig.rb
, and generate new data keys viarake
. (MONGOID-5585, MONGOID-5587, MONGOID-5589, MONGOID-5592, MONGOID-5613, MONGOID-5615.)
Many other changes are included as well, including the following:
- Support for Rails 2.6 and Rails 5 have been dropped. (MONGOID-5574)
- Support has been added for JRuby 9.4, and BSON 5. (MONGOID-5575, MONGOID-5739, RUBY-2846)
- Added
Mongoid.reconnect_clients
in conjunction with improving documentation about working with forking webservers. (MONGOID-5758) - Saving a model in a session other than the one that loaded it will now result in a warning message (as this is generally considered a bug.) (MONGOID-5552)
- Eager loading now works with embedded associations. These associations cannot actually be eager loaded, but this allows you to chain eager loading through embedded associations, for example with has-and-belongs-to-many associations. (MONGOID-5052)
- For embedded associations, the default is now
touch: true
. This means that when you update an embedded document, its parent is automatically touched (or saved, with the timestamps updated) as well. (MONGOID-5016) - You can now prevent Mongoid from type-casting a given value in a query by wrapping it with
Mongoid::RawValue
. This makes it easier to deal with legacy data that does not conform to an expected type. (MONGOID-5408) - The Rails generator for Mongoid (
rails g mongoid:config
) now additionally generates a defaultconfig/initializers/mongoid.rb
. (MONGOID-5439) - When calling
#touch
on a model, Mongoid now clears the 'changed' state of the model. Previously,#touch
left the model in a 'changed' state, even though it had been persisted by the touch operation. (MONGOID-5504) - Mongoid's
db:mongoid:create_indexes
rake task was not always loading all models before creating the indexes, resulting in some missing indexes. This is now fixed. (MONGOID-5547) - Added support for
$min
,$max
, and$mul
operators (viaset_min
,set_max
, andmul
), as well as$setOnInsert
when doing an upsert (via a new:set_on_insert
option to#upsert
). (MONGOID-5442) - A timezone configured in your app (via
Time.zone=
) will now be used when typecasting dates for time-valued fields. (MONGOID-5488) - Typecasting strings for numeric fields now correctly converts the strings into
BigDecimal
values. (MONGOID-5484) - Field aliases are now honored in index specifications. (MONGOID-5314)
- Fixed an issue where an empty list in a HABTM association needed special handling (instead of blindly using an empty list with
$in
). (MONGOID-5164) - Attempting to call
estimated_count
when a default scope is active on a collection now raises a dedicated exception (Mongoid::Errors::InvalidEstimatedCountScoping
) (MONGOID-4960) - Mongoid now raises
Mongoid::Errors:AttributeNotLoaded
when a program attempts to access a field that is defined on the model, but which was excluded by the query's projection. Previously,ActiveModel::MissingAttributeError
was raised in this situation. (MONGOID-5467) - When assigning an array of Hashes to a field, the hashes are always converted to a
BSON::Document
. This makes the behavior consistent with how those fields are loaded from the database. (MONGOID-5410)
Additionally, a number of methods that were monkey-patched onto core modules have been deprecated, including the following:
Array#multi_arged?
(MONGOID-5669)BigDecimal#__to_inc__
(MONGOID-5662)Hash#__consolidate__
(MONGOID-5654)Hash#__mongoid_unsatisfiable_criteria?
(MONGOID-5671)Hash#__nested__
(MONGOID-5653)Hash#delete_id
(MONGOID-5670)Hash#extract_id
(MONGOID-5670)Hash#to_criteria
(MONGOID-5677)Integer#unconvertable_to_bson?
Object#__find_args__
(MONGOID-5665)Object#__mongoize_fk__
(MONGOID-5675)Object#__setter__
(MONGOID-5664)Object#__sortable__
(MONGOID-5663)Object#__to_inc__
(MONGOID-5662)Object#blank_criteria?
(MONGOID-5671)Object#do_or_do_not
(MONGOID-5673)Object#regexp?
(MONGOID-5674)Object#you_must
(MONGOID-5673)String#mongoid_id?
(MONGOID-5668)String#unconvertable_to_bson?
(MONGOID-5667)Symbol#mongoid_id?
(MONGOID-5668)Time#configured
(MONGOID-5676)
Also, Criteria#for_js
has been deprecated (MONGOID-5651), and Mongoid::QueryCache
(which was previously deprecated) has been removed (MONGOID-5625).
8.1.5
This patch release includes the following fixes:
MONGOID-5704: By default, associations (like belongs_to
) are validated when a document is saved. However, Mongoid was aggressively loading persisted associations and validating them, which led to a significant performance regression in Mongoid 8+ (versus Mongoid 7.x). This patch fixes this regression by only validating associations that are (1) currently in-memory, and (2) either unpersisted or modified.
MONGOID-5709: has_and_belongs_to_many associations on embedded docments were broken, and attempting to use them would result in an "InvalidPath" exception. This patch release fixes that bug.
8.0.8
This patch release includes the following fixes:
MONGOID-5704: By default, associations (like belongs_to
) are validated when a document is saved. However, Mongoid was aggressively loading persisted associations and validating them, which led to a significant performance regression in Mongoid 8+ (versus Mongoid 7.x). This patch fixes this regression by only validating associations that are (1) currently in-memory, and (2) either unpersisted or modified.
MONGOID-5709: has_and_belongs_to_many associations on embedded docments were broken, and attempting to use them would result in an "InvalidPath" exception. This patch release fixes that bug.
8.1.4
This is a patch release in 8.1.x series fixes the following issue:
We strongly recommend to upgrade to this version if you use 8.1.3.
This release also adds the following improvement:
8.1.3
This is a patch release in 8.1.x series that adds support for Rails 7.1.
The following issues were fixed: