7.4.0
Mongoid 7.4.0 is a feature release fully compatible with 7.3. All behavior changes described below are optional and must be opted-into by toggling the respective configuration options.
Mongoid 7.4 formally supports Ruby 3.1.
Mongoid 7.4 formally supports MongoDB server 5.0 and deprecates support for servers 3.4 and earlier. Mongoid 8 will require server 3.6 or newer.
For a more thorough description of the new functionality, and the options needed to enable it, please review the release notes.
The following major improvements are available in 7.4.0:
- MONGOID-5128 Scoped associations - Add :scope parameter to associations
- MONGOID-5028 demongoize custom fields on pluck
- MONGOID-5162 Remove BSON::ObjectId#as_json override
- MONGOID-5195 _matches? can limit to millisecond precision when comparing Time objects
- MONGOID-5005 .sum and similar aggregables ignore sort if not limiting/skipping
- MONGOID-5186 .with_scope restores previous scope
- MONGOID-5260 Add _translations fields and dot-navigation to pluck and distinct
- MONGOID-5105 Allow block form in Mongoid::Association::EmbedsMany::Proxy#count
- MONGOID-5126 Bring Mongoid::Document's === implementation in alignment with Ruby behavior
- MONGOID-5151 Respect aliased fields in pluck/distinct by having Document.database_field_name recursively consider embedded docs
- MONGOID-5103 Implement eq symbol operator
The following bugs were fixed and, where previously the functionality worked in a different way rather than was completely unusable, must also be explicitly requested via the respective options:
- MONGOID-5240 embeds_many does not get reset after clear
- MONGOID-5198 Calling children_changed? on a deep cyclical data structure will cause semi-infinite looping
- MONGOID-5206 Reloading retains stale changed value
- MONGOID-5183 Existing
$and
clause in query is overwritten bywhere
condition - MONGOID-5199 Reloadable#reload_embedded_document doesn't respect session
- MONGOID-4755 Mongoid::Contextual::Aggregable::Mongo#sum does not return nil as expected for Mongoid::Document#none
- MONGOID-5194 has_and_belongs_to_many custom primary key gets ignored when building a document or adding multiple documents
- MONGOID-5204 default_scopes duplication, query scope inconsistency
- MONGOID-5208 Error when reloading with a nil embedded field
- MONGOID-5219 Uniqueness validation for StringifiedSymbol field in an embedded document fails