@@ -191,6 +191,24 @@ persistence operation per parent document, even when using multiple
191191levels of nested embedded documents.
192192
193193
194+ ``embedded_in`` associations now default to ``touch: true``
195+ -----------------------------------------------------------
196+
197+ Updating an embedded subdocument will now automatically touch the parent,
198+ unless you explicitly set ``touch: false`` on the relation:
199+
200+ .. code-block:: ruby
201+
202+ class Address
203+ include Mongoid::Document
204+ include Mongoid::Timestamps
205+
206+ embedded_in :mall, touch: false
207+ end
208+
209+ For all other associations, the default remains ``touch: false``.
210+
211+
194212Flipped default for ``:replace`` option in ``#upsert``
195213------------------------------------------------------
196214
@@ -204,6 +222,25 @@ This means that, by default, Mongoid 9 will update the existing document and
204222will not replace it.
205223
206224
225+ The immutability of the ``_id`` field is now enforced
226+ -----------------------------------------------------
227+
228+ Prior to Mongoid 9.0, mutating the ``_id`` field behaved inconsistently
229+ depending on whether the document was top-level or embedded, and depending on
230+ how the update was performed. As of 9.0, changing the ``_id`` field will now
231+ raise an exception when the document is saved, if the document had been
232+ previously persisted.
233+
234+ Mongoid 9.0 also introduces a new feature flag, ``immutable_ids``, which
235+ defaults to ``true``.
236+
237+ .. code-block:: ruby
238+
239+ Mongoid::Config.immutable_ids = true
240+
241+ When set to false, the older, inconsistent behavior is restored.
242+
243+
207244Bug Fixes and Improvements
208245--------------------------
209246
0 commit comments