Mongoid v2.3.0 Release Notes
-
๐ New Features
๐ Mongoid now supports basic localized fields, storing them under the covers as a hash of locale => value pairs.
field :name, localize: true
0๏ธโฃ #1275 For applications that default safe mode to true, you can now tell a single operation to persist without safe mode via #unsafely:
person.unsafely.save
,Person.unsafely.create
. (Matt Sanders)๐ #1256 Mongoid now can create indexes for models in Rails engines. (Caio Filipini)
#1228 Allow pre formatting of compsoite keys by passing a block to #key. (Ben Hundley)
๐ #1222 Scoped mass assignment is now supported. (Andrew Shaydurov)
#1196 Timestamps can now be turned off on a call-by-call basis via the use of #timeless:
person.timeless.save
,Person.timeless.create(:title => "Sir")
.#1103 Allow developers to create their own custom complex criteria. (Ryan Ong)
Mongoid now includes all defined fields in
serializable_hash
andto_json
results even if the fields have no values to make serialized documents easier to use by ActiveResource clients.๐ Support for MongoDB's $and operator is now available in the form of:
Criteria#all_of(*args)
where args is multiple hash expressions.#1250, #1058 Embedded documents now can have their callbacks fired on a parent save by setting
:cascade_callbacks => true
on the relation. (pyromanic, Paul Rosania, Jak Charlton)
Major Changes
Mongoid now depends on Active Model 3.1 and higher.
๐ Mongoid now depends on the Mongo Ruby Driver 1.4 and higher.
Mongoid requires MongoDB 2.0.0 and higher.
Resolved Issues
๐ #1308 Fixed scoping of HABTM finds.
#1300 Namespaced models should handle recursive embedding properly.
#1299 Self referenced documents with versioning no longer fail when inverse_of is not defined on all relations.
๐ #1296 Renamed internal building method to _building.
โก๏ธ #1288, #1289 _id and updated_at should not be part of versioned attributes.
๐ง #1273 Mongoid.preload_models now checks if preload configuration option is set, where Mongoid.load_models always loads everything. (Ryan McGeary)
0๏ธโฃ #1244 Has one relations now adhere to default dependant behavior.
๐ #1225 Fixed delayed persistence of embedded documents via $set.
#1166 Don't load config in Railtie if no env variables defined. (Terence Lee)
#1052
alias_attribute
now works again as expected.0๏ธโฃ #939 Apply default attributes when upcasting via #becomes. (Christos Pappas)
๐ #932 Fixed casting of integer fields with leading zeros.
๐ฏ #948 Reset version number on clone if versions existed.
๐ #763 Don't merge $in criteria arrays when chaining named scopes.
#730 Existing models that have relations added post persistence of originals can now have new relations added with no migrations.
#726 Embedded documents with compound keys not validate uniqueness correctly.
#582 Cyclic non embedded relations now validate uniqueness correctly.
#484 Validates uniqueness with multiple scopes of all types now work properly.
Deleting versions created with
Mongoid::Versioning
no longer fires off dependent cascading on relations.