Changelog History
Page 7
-
v2.4.4 Changes
Resolved Issues
#1705 Allow changing the order of many to many foreign keys.
โก๏ธ #1703 Updated at is now versioned again. (Lucas Souza)
๐ #1686 Set the base metadata on unbind as well as bind for belongs to relations.
#1681 Attempt to create indexes for models without namespacing if the namespace does not exist for the subdirectory.
0๏ธโฃ #1676 Allow eager loading to work as a default scope.
#1665/#1672 Expand complex criteria in nested criteria selectors, like #matches. (Hans Hasselberg)
#1668 Ensure Mongoid logger exists before calling warn. (Rรฉmy Coutable)
๐ฏ #1661 Ensure uniqueness validation works on cloned documents.
#1659 Clear delayed atomic sets when resetting the same embedded relation.
#1656/#1657 Don't hit database for uniqueness validation if BOTH scope and attribute hasn't changed. (priyaaank)
#1205/#1642 When limiting fields returned from the database via
Criteria#only
andCriteria#without
and then subsequently saving the document. Default values no longer override excluded fields.
-
v2.4.3 Changes
Resolved Issues
#1647 DateTime serialization when already in UTC does not convert to local time.
#1641/#1639 Mongoid.observer.disable :all now behaves as AR does.
โก๏ธ #1640 Update consumers should be tied to the name of the collection they persist to, not the name of the class.
#1637/#1636 Scopes no longer modify parent class scopes when subclassing. (Hans Hasselberg)
#1629 $all and $in criteria on embedded many relations now properly handles regex searches and elements of varying length. (Douwe Maan)
0๏ธโฃ #1623/#1634 Default scopes no longer break Mongoid::Versioning. (Hans Hasselberg)
๐ #1605 Fix regression of rescue responses, Rails 3.2
-
v2.4.2 Changes
Resolved Issues
#1628 _type field can once again be included in serialization to json or xml as a global option with
include_type_for_serialization
. (Roman Shterenzon)#1627 Validating format now works properly with localized fields. (Douwe Maan)
#1617 Relation proxy methods now show up in Mongoid's list of prohibited fields.
๐ง #1615 Allow a single configuration of host and port for all spec runs, overridden by setting MONGOID_SPEC_HOST and MONGOID_SPEC_PORT env vars.
#1610 When versioning paranoid documents and max version is set, hard delete old versions from the embedded relation.
#1609 Allow connection retry during cursor iteration as well as all other operations.
#1608 Guard against no method errors when passing ids in nested attributes and the documents do not exist.
๐ #1605 Remove deprecation warning on rescue responses, Rails 3.2
#1602 Preserve structure of $and and $or queries when typecasting.
#1600 Uniqueness validation no longer errors when provided a relation.
#1599 Make sure enumerable targets yield to what is in memory first when performing #each, not always the unloaded first.
#1597 Fix the ability to change the order of array fields with the same elements.
#1590 Allow proper serialization of boolean values in criteria where the field is nested inside an array.
-
v2.4.1 Changes
Resolved Issues
โก๏ธ #1593 Arrays on embedded documents now properly atomically update when modified from original version.
#1592 Don't swallow exceptions from index generation in the create_indexes rake task.
#1589 Allow assignment of empty array to HABTM when no documents are yet loaded into memory.
#1587 When a previous value for an array field was an explicit nil, it can now be reset atomically with new values.
#1585
Model#respond_to?
returns true now for the setter when allowing dynamic fields.#1582 Allow nil values to be set in arrays.
#1580 Allow arrays to be set to nil post save, and not just empty.
#1579 Don't call #to_a on individual set field elements in criterion.
#1576 Don't hit database on uniqueness validation if the field getting validated has not changed.
#1571 Aliased fields get all the dirty attribute methods and all getters and setters for both the original name and the alias. (Hans Hasselberg)
๐ง #1568 Fallback to development environment with warning when no env configured.
๐ #1565 For fields and foreign keys with non-standard Ruby or database names, use define_method instead of class_eval for creating the accessors and dirty methods.
#1557 Internal strategy class no longer conflicts with models.
#1551 Parent documents now return
true
forModel#changed?
if only child (embedded) documents have changed.#1547 Resetting persisted children from a parent save when new waits until post callbacks, mirroring update functionality.
#1536 Eager loading now happens when calling
first
orlast
on a criteria if inclusions are specified.
-
v2.4.0 Changes
๐ New Features
Ranges can now be passed to #where criteria to create a $gte/$lte query under the covers.
Person.where(dob: start_date...end_date)
Custom serializable fields can now override #selection to provide customized serialization for criteria queries.
#1544 Internals use
Array.wrap
instead ofto_a
now where possible.๐ #1511 Presence validation now supports localized fields. (Tiago Rafael Godinho)
#1506
Model.set
will now accept false and nil values. (Marten Veldthuis)#1505
Model.delete_all/destroy_all
now take either a :conditions hash or the attributes directly.#1504
Model.recursively_embeds_many
now accepts a :cascade_callbacks option. (Pavel Pravosud)#1496 Mongoid now casts strings back to symbols for symbol fields that get saved as strings by another application.
#1454, #900 Associations now have an
after_build
callback that gets executed after.build
orbuild_
methods are called. (Jeffrey Jones, Ryan Townsend)#1451 Ranges can now be any range value, not just numbers. (aupajo)
#1448 Localization is now used when sorting. (Hans Hasselberg)
#1422 Mongoid raises an error at yaml load if no environment is found. (Tom Stuart)
๐ #1413 $not support added to criteria symbol methods. (Marc Weil)
#1403 Added configuration option
scope_overwrite_exception
which defaults to false for raising an error when defining a named scope with the same name of an existing method. (Christoph Grabo)#1388
model.add_to_set
now supports adding multiple values and performs an $addToSet with $each under the covers. (Christian Felder)๐ #1387 Added
Model#cache_key
for use in Rails caching. (Seivan Heidari)#1380 Calling Model.find(id) will now properly convert to and from any type based on the type of the _id field.
0๏ธโฃ #1363 Added fallbacks and default support to localized fields, and added ability to get and set all translations at once.
#1362 Aliased fields now properly typecast in criteria.
#1337 Array fields, including HABTM many foreign keys now have smarter dirty checking and no longer perform a simple $set if the array has changed. If items have only been added to the array, it performs a $pushAll. If items have only been removed, it performs a $pullAll. If both additions and removals have occurred it performs a $set to avoid conflicting mods.
Resolved Issues
Calling
Document#as_document
on a frozen document on Rubinius returns the attributes instead of nil.0๏ธโฃ #1554 Split application of default values into proc/non-procs, where non-procs get executed immediately during instantiation, and procs get executed after all other values are set.
#1553 Combinations of adding and removing values from an array use a $set on the current contents of the array, not the new values.
#1546 Dirty changes should be returned in a hash with indifferent access.
#1542 Eager loading now respects the options (ie skip, limit) provided to the criteria when fetch the associations.
#1530 Don't duplicate added values to arrays via dirty tracking if the array is a foreign key field.
#1529 Calling
unscoped
on relational associations now works properly.#1524 Allow access to relations in overridden field setters by pre-setting foreign key default values.
#1523 Allow disabling of observers via
disable
. (Jonas Schneider)๐ #1522 Fixed create indexes rake task for Rails 3.2. (Gray Manley)
#1517 Fix Mongoid documents to properly work with RSpec's stub_model. (Tiago Rafael Godinho)
#1516 Don't duplicate relational many documents on bind.
#1515 Mongoid no longer attempts to serialize custom fields on complex criteria by default.
#1503 Has many relation substitution now handles any kind of mix of existing and new docs.
#1502 Nested attributes on embedded documents respects if the child is paranoid.
#1497 Use provided message on failing uniqueness validation. (Justin Etheredge)
0๏ธโฃ #1491 Return nil when no default set on localized fields. (Tiago Rafael Godinho)
#1483 Sending module includes at runtime which add new fields to a parent document, also have the fields added to subclasses.
๐ #1482 Applying new sorting options does not merge into previously chained criteria. (Gerad Suyderhoud)
#1481 Fix invalid query when accessing many-to-many relations before defaults are set.
#1480 Mongoid's internal serialized field types renamespaced to Internal in order to not conflict with ruby core classes in custom serializable types.
#1479 Don't duplicate ids on many-to-many when using create or create!
#1469 When extract_id returns nil, get the document out of the identity map by the criteria selector.
๐ #1467 Defining a field named metadata now properly raises an invalid field error.
#1463 Batch insert consumers are now scoped to collection to avoid persistence of documents to other collections in callbacks going to the wrong place.
#1462 Assigning has many relations via nested attribtues
*_attributes=
does not autosave the relation.๐ #1461 Fixed serialization of foreign key fields in complex criteria not to escape the entire hash.
#1458 Versioning no longer skips fields that have been protected from mass assignment.
#1455, #1456 Calling destroy on any document now temporarily marks it as flagged for destroy until the operation is complete. (Nader Akhnoukh)
#1453
Model#to_key
should return a value when the document is destroyed.#1449 New documents no longer get persisted when replaced on a has one as a side effect. (jasonsydes)
#1439 embedded? should return true when relation defined as cyclic.
#1433 Polymorphic nested attributes for embedded and relational 1-1 now update properly.
๐ฏ #1426 Frozen documents can now be cloned. (aagrawal2001)
#1382 Raise proper error when creating indexes via rake task if index definition is incorrect. (Mathieu Ravaux)
#1381, #1371 The identity map now functions properly with inherited documents. (Paul Canavese)
#1370 Split concat on embedded arrays into its own method to handle the batch processing due to after callback run execution issues.
#1366 Array and hash values now get deep copied for dirty tracking.
0๏ธโฃ #1359 Provide ability to not have default scope applied to all named scopes via using lambdas.
๐ #1333 Fixed errors with custom types that exist in namespaces. (Peter Gumeson)
0๏ธโฃ #1259 Default values are treated as dirty if they differ from the database state.
0๏ธโฃ #1255 Ensure embedded documents respect the defined default scope.
-
v2.3.4 Changes
#1445 Prevent duplicate documents in the loaded array on the target enumerable for relational associations.
#1442 When using create_ methods for has one relations, the appropriate destructive methods now get called when replacing an existing document.
#1431 Enumerable context should add to the loaded array post yield, so that methods like #any? that short circuit based on the value of the block dont falsely have extra documents.
#1418 Documents being loaded from the database for revision purposes no longer get placed in the identity map.
#1399 Allow conversion of strings to integers in foreign keys where the id is defined as an int.
0๏ธโฃ #1397 Don't add default sorting criteria on first if they sort criteria already exists.
#1394 Fix exists? to work when count is greater than 1. (Nick Hoffman)
#1392 Return 0 on aggregation functions where field is nonexistent.
#1391 Uniqueness validation now works properly on embedded documents that are using primary key definitions.
#1390 When _type field is lower case class camelize before constantizing.
#1383 Fix cast on read for serializable fields that are subclassed.
โก๏ธ #1357 Delayed atomic sets from update_attributes on embedded documents multiple levels deep now properly persist.
#1326 Ensure base document on HABTM gets its keys saved after saving a newly build child document.
๐ #1301 Don't overwrite base metadata on embedded in relations if already set.
#1221 HABTM with inverse nil is allowed again on embedded documents.
#1208 Don't auto-persist child documents via the setter when setting from an embedded_in.
โก๏ธ #791 Root document updates its timestamps when only embedded documents have changed.
-
v2.3.3 Changes
Resolved Issues
#1386 Lowered mongo/bson dependency to 1.3
#1377 Fix aggregation functions to properly handle nil or indefined values. (Maxime Garcia)
#1373 Warn if a scope overrides another scope.
#1372 Never persist when binding inside of a read attribute for validation.
๐ #1364 Fixed reloading of documents with non bson object id ids.
๐ #1360 Fixed performance of Mongoid's observer instantiation by hooking into Active Support's load hooks, a la AR.
๐ #1358 Fixed type error on many to many synchronization when inverse_of is set to nil.
#1356 $in criteria can now be chained to non-complex criteria on the same key without error.
๐ #1350, #1351 Fixed errors in the string conversions of double quotes and tilde when paramterizing keys.
#1349 Mongoid documents should not blow up when including Enumerable. (Jonas Nicklas)
-
v2.3.2 Changes
Resolved Issues
#1347 Fix embedded matchers when provided a hash value that does not have a modifier as a key.
0๏ธโฃ #1346 Dup default sorting criteria when calling first/last on a criteria.
#1343 When passing no arguments to
Criteria#all_of
return all documents. (Chris Leishman)#1339 Ensure destroy callbacks are run on cascadable children when deleting via nested attributes.
#1324 Setting
inverse_of: nil
on a many-to-many referencing the same class returns nil for the inverse foreign key.#1323 Allow both strings and symbols as ids in the attributes array for nested attributes. (Michael Wood)
#1312 Setting a logger on the config now accepts anything that quacks like a logger.
#1297 Don't hit the database when accessing relations if the base is new.
0๏ธโฃ #1239 Allow appending of referenced relations in create blocks, post default set.
#1236 Ensure all models are loaded in rake tasks, so even in threadsafe mode all indexes can be created.
#736 Calling #reload on embedded documents now works properly.
-
v2.3.1 Changes
Resolved Issues
#1338 Calling #find on a scope or relation checks that the document in the identity map actually matches other scope parameters.
#1321 HABTM no longer allows duplicate entries or keys, instead of the previous inconsistencies.
๐ #1320 Fixed errors in perf benchmark.
#1316 Added a separate Rake task "db:mongoid:drop" so Mongoid and AR can coexist. (Daniel Vartanov)
#1311 Fix issue with custom field serialization inheriting from hash.
#1310 The referenced many enumerable target no longer duplicates loaded and added documents when the identity map is enabled.
๐ #1295 Fixed having multiple includes only execute the eager loading of the first.
๐ #1287 Fixed max versions limitation with versioning.
#1277 attribute_will_change! properly flags the attribute even if no change occurred.
#1063 Paranoid documents properly run destroy callbacks on soft destroy.
#1061 Raise
Mongoid::Errors::InvalidTime
when time serialization fails.#1002 Check for legal bson ids when attempting conversion.
#920 Allow relations to be named target.
๐ #905 Return normalized class name in metadata if string was defined with a prefixed ::.
#861 accepts_nested_attributes_for is no longer needed to set embedded documents via a hash or array of hashes directly.
๐ #857 Fixed cascading of dependent relations when base document is paranoid.
๐ #768 Fixed class_attribute definitions module wide.
#408 Embedded documents can now be soft deleted via
Mongoid::Paranoia
.
-
v2.3.0 Changes
๐ 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.