Skip to content

Commit d0980b3

Browse files
MONGOID-5073 Document changes (#4990)
1 parent 6d30885 commit d0980b3

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

source/tutorials/mongoid-upgrade.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,31 @@ It is now possible to :ref:`remove the id alias in models <unalias-id>`,
279279
to make ``id`` a regular field.
280280

281281

282+
``Mongoid.purge!`` and ``Mongoid.truncate`` take the global overrides into account
283+
----------------------------------------------------------------------------------
284+
285+
Minor change: ``Mongoid.purge!`` and ``Mongoid.truncate!`` now consider global
286+
overrides set with ``Mongoid.override_database`` and ``Mongoid.override_client``.
287+
288+
Mongoid 7.3 behavior:
289+
290+
.. code-block:: ruby
291+
Mongoid.override_database("some_other_db")
292+
Band.create!(name: "Garage")
293+
Band.count # => 1
294+
Mongoid.purge! # or Mongoid.truncate!
295+
Band.count # => 0
296+
297+
Mongoid 7.2 behavior:
298+
299+
.. code-block:: ruby
300+
Mongoid.override_database("some_other_db")
301+
Band.create!(name: "Garage")
302+
Band.count # => 1
303+
Mongoid.purge! # or Mongoid.truncate!
304+
Band.count # => 1
305+
306+
282307
Upgrading to Mongoid 7.2
283308
========================
284309

0 commit comments

Comments
 (0)