Releases: mongodb/mongoid
7.5.2
This patch release in the 7.5 series adds the following minor improvements and bug fixes:
- MONGOID-5255 Do not allow reuse of a closed client
- MONGOID-5417 Fix memory leak when call 'with'
- MONGOID-5452 Add legacy_attributes to 7.5
- MONGOID-5433 Replace calls of Time#to_s(format) with Time#to_formatted_s
8.0.2
This patch release in the 8.0 series adds the following minor improvement:
The following issues have been fixed:
- MONGOID-5435 ArgumentError when scope block has positional and keyword arguments
- MONGOID-5436 legacy_triple_equals used incorrectly
Also read the full Mongoid 8.0 release notes.
7.5.1
This patch release in the 7.4 series fixes the following issues:
7.4.3
This patch release in the 7.4 series fixes the following issue:
8.0.1
Mongoid 8.0 is a feature release with the following significant new functionality:
- MONGOID-4627 Callback behavior during persistence operations fixed
- MONGOID-4641 Ability to store BigDecimal fields as decimal128 in the database
- MONGOID-5332 Consistent mongoization, demongoization and evolution of unconvertable values
- MONGOID-5428 Ability to set driver options in mongoid.yml
- MONGOID-5365 Change #attributes return value to Hash with a flag
The following additional improvements were made:
- MONGOID-4547 Implement #take / #take! for AR feature parity
- MONGOID-5270 Implement .tally method for Mongoid#Criteria
- MONGOID-4998 Support limit argument in #first and #last, :id_sort option removed
- MONGOID-5351 Implement Dots and Dollars in Mongoid
- MONGOID-5098 Mongoize Range endpoints + support begin-less/end-less ranges
- MONGOID-5003 Delegate Model#find with block argument to Enumerable#find
- MONGOID-5180 Rails parity: Add #pick method (equivalent to pluck.first)
- MONGOID-5315 Accept formatted strings in Date/Time/DateTime.demongoize
- MONGOID-5217 Add attribute_previously_was helpers
- MONGOID-5390 #pluck in memory should return nil values (non-compacted)
- MONGOID-5402 In-memory pluck, distinct should support dot-notation for field path traversal
- MONGOID-5404 Populate attributes_before_type_cast on read from database
- MONGOID-3267 Allow associations to be used inside defaults
- MONGOID-4500 Mongoid::Contextual::Aggregable::Memory should ignore nil and non-numeric values
The following minor improvements were made:
- MONGOID-5376 Use exists? or any? instead of count to determine existence of any document
- MONGOID-5306 Use pluck instead of only to avoid projecting when referencing association _ids
- MONGOID-5353 Change "taken" error message text to match ActiveRecord / Rails I18n
- MONGOID-5327 Prohibit using undefined string/symbol types when declaring fields
The following functionality was deprecated:
The following functionality was removed:
- MONGOID-5414 Remove criteria/contextual caching
- MONGOID-4686 Remove Document#to_a
- MONGOID-5302 Remove update_values method from Hash and Array extensions
- MONGOID-5323 Remove deprecated Mongoid::Errors::EagerLoad
- MONGOID-5341 Remove drop_dup options from index macro
- MONGOID-5322 Remove deprecated geo_spacial method
- MONGOID-5324 Remove deprecated constants
- MONGOID-5426 Remove pluck behavior from map
The following issues were fixed:
- MONGOID-5089 Incorrect foreign key value set in has_many target when an orphan child is associated with parent via its id
- MONGOID-5104 attribute_was returns previous value in after_save callback
- MONGOID-2306 cascade_callbacks not working using before_create and <<
- MONGOID-3601 Don't mark embedded objects as persisted when the parent is invalid
- MONGOID-4160 Don't persist document if associated document is invalid with optional: false
- MONGOID-4397 update_attributes does not reflect changes to embedded documents in the attributes hash
- MONGOID-4476 Writes in callbacks of nested embedded documents are not persisted when top-level document is modified via update_attributes
- MONGOID-4520 Set inverse keys on HABTM relationship when subsequently persisting document
- MONGOID-4646 has_one - belongs_to with optional:true incorrectly clears association when assigned itself
- MONGOID-4843 don't populate .changed_attributes setting has_and_belongs_to_many association
- MONGOID-4911 Range expansion must use $elemMatch to ensure both $gte and $lte match the same array element
- MONGOID-5034 When excluded from query, embeds many relations are returned as empty array instead of raising MissingAttributeError
- MONGOID-5037 destroy_all with conditions argument constrains the embedded documents being destroyed with their full attribute tree
- MONGOID-5039 Multiple polymorphic embeds cause wrong association to be assigned
- MONGOID-5043 'where' query incorrectly works for belongs_to relations with custom primary_key
- MONGOID-5078 Background jobs queued during after_save, which atomically query sharded documents, fail because of atomic_selector.
- MONGOID-5079 clear has_many association locally after destroy_all
- MONGOID-5110 Parent ID missing in after_destroy callback when removing via nested attribute
- MONGOID-5172 Criteria#any_of with multiple arguments incorrectly adds conditions to existing top-level $or if one is already present
- MONGOID-5190 Respect persistence options on auto-saved associations
- MONGOID-2586 cannot access parent object in the after_find function
- MONGOID-3291 Clear inverse associations when setting across all association types
- MONGOID-4316 Eager loading loads unnecessary documents when multiple associations reference the same model class
- MONGOID-4514 Counter cache not decremented when nullifying relation/association
- MONGOID-4705 Inverse association not populated for HABTM when using class_name
- MONGOID-4716 Fix eager loading of nested referenced associations
- MONGOID-4811 Output controller runtime stats in milliseconds as per Rails requirements
- MONGOID-4823 Values for BSON::Binary fields are not converted to Binary
- MONGOID-4838 safely use #clone method on embedded children with fields changed/removed
- MONGOID-4869 Setting an embeds_many association to empty array does not persist it when a document is created
- MONGOID-5255 Unexpected client close with Runtime Persistence
- MONGOID-5269 Persist writing an attribute after a removal correctly
- MONGOID-5280 Mongoid 7.4 inserts only one embedded document when multiple documents are created with nil _id
- MONGOID-5344 Using concat on has_and_belongs_to_many ids default value is not working the first time
- MONGOID-5352 Fix assign_attributes on replacing embeds_many
- MONGOID-5379 The use runtime persistence raises an error for updates
- MONGOID-5380 Assignment of embedded association doesn't work when used before another association assignment
- MONGOID-5416 Mongoid::Contextual#last modifies the sort on the view
Mongoid 8 requires MongoDB 3.6 or newer, Ruby 2.6 or newer, JRuby 9.3 or newer, ActiveSupport 5.2 or newer. Older versions of these libraries and environments are not supported.
Mongoid 8.0.1 is the first release in the 8.0 series. The 8.0.0 release was yanked due to incorrect gem dependency on a pre-release driver version.
7.5.0
This release in the 7.x series is primarily intended to assist with migration to Mongoid 8. To this end, Mongoid 7.5 adds deprecation warnings for functionality removed in Mongoid 8. Some of the new functionality in Mongoid 8 is also available in 7.5, as follows:
- MONGOID-4547 Implement #take / #take! for AR feature parity
- MONGOID-4998 limit arguments to #first and #last methods
- MONGOID-5402 In-memory pluck, distinct support dot notation for field path traversal
The following deprecations have been added:
- MONGOID-5431 Deprecate criteria/contextual caching
- MONGOID-5318 Deprecate "background" index option as per MongoDB 4.2+
- MONGOID-5430 Deprecate pluck behavior in map
The following issues were fixed:
Mongoid 7.5 adds support for JRuby 9.3 and deprecates support for JRuby 9.2. Mongoid 8 will require JRuby 9.3 or newer.
7.4.1
This patch release in the 7.4 series adds support for MongoDB 6.0 and the following improvement:
The following issues have been fixed:
7.3.5
This patch release in the 7.3 series fixes the following issues:
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
7.3.4
This patch release in the 7.3 series adds compatibility with Rails 7.
The following bug was fixed: