You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/transactions.md
+44-2Lines changed: 44 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,8 +63,22 @@ doc.isNew;
63
63
64
64
## Note About Parallelism in Transactions {#note-about-parallelism-in-transactions}
65
65
66
-
Running operations in parallel is **not supported** during a transaction. The use of `Promise.all`, `Promise.allSettled`, `Promise.race`, etc. to parallelize operations inside a transaction is
67
-
undefined behaviour and should be avoided.
66
+
Running operations in parallel is **not supported** during a transaction.
67
+
The use of `Promise.all`, `Promise.allSettled`, `Promise.race`, etc. to parallelize operations inside a transaction is undefined behaviour and should be avoided.
68
+
69
+
MongoDB also does not support multiple transactions on the same session in parallel.
70
+
This also means MongoDB does not support nested transactions on the same session.
71
+
The following code will throw a `Transaction already in progress` error.
However, if the nested transaction fails, the top-level transaction will still be rolled back because `await mongoose.connection.transaction()` throws.
0 commit comments