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.