Skip to content

Commit

Permalink
Merge pull request #2666 from pawciobiel/patch-1
Browse files Browse the repository at this point in the history
Update connecting.rst - Add a note about inheritance and switch_db
  • Loading branch information
bagerard committed Oct 23, 2022
2 parents 4567887 + f81e88e commit 8ea77fc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/guide/connecting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ access to the same User document across databases::
with switch_db(User, 'archive-user-db') as User:
User(name='Ross').save() # Saves the 'archive-user-db'

.. note:: :func:`~mongoengine.context_managers.switch_db` when used on
a class that allow inheritance will change the database alias
for instances of a given class only - instances of subclasses will still use
the default database.

Switch Collection
-----------------
Expand Down

0 comments on commit 8ea77fc

Please sign in to comment.