@@ -41,3 +41,39 @@ effect. Rather, if you need to close the connection pool, use
41
41
.. versionadded :: 5.2.0b0
42
42
43
43
Support for connection pooling and ``connection.close_pool() `` were added.
44
+
45
+ .. _transactions :
46
+
47
+ Transactions
48
+ ============
49
+
50
+ .. versionadded :: 5.2.0b2
51
+
52
+ Support for transactions is enabled if the MongoDB configuration supports them:
53
+ MongoDB must be configured as a :doc: `replica set <manual:replication >` or
54
+ :doc: `sharded cluster <manual:sharding >`, and the store engine must be
55
+ :doc: `WiredTiger <manual:core/wiredtiger >`.
56
+
57
+ If transactions aren't supported (and for any queries run outside of an
58
+ :func: `~django.db.transaction.atomic ` block), query execution uses Django and
59
+ MongoDB's default behavior of autocommit mode. Each query is immediately
60
+ committed to the database.
61
+
62
+ If transactions aren't supported, Django's :doc: `transaction management APIs
63
+ <django:topics/db/transactions>` function as no-ops.
64
+
65
+ Limitations
66
+ -----------
67
+
68
+ MongoDB's transactions have some limitations.
69
+
70
+ - :meth: `QuerySet.union() <django.db.models.query.QuerySet.union> ` is not
71
+ supported.
72
+ - If a transaction raises an exception, the transaction is no longer usable.
73
+ For example, if the update stage of :meth: `QuerySet.update_or_create()
74
+ <django.db.models.query.QuerySet.update_or_create> ` fails with
75
+ :class: `~django.db.IntegrityError ` due to a unique constraint violation, the
76
+ create stage won't be able to proceed.
77
+ :class: `pymongo.errors.OperationFailure ` is raised, wrapped by
78
+ :class: `django.db.DatabaseError `.
79
+ - Savepoints are not supported.
0 commit comments