Skip to content

Commit 563f293

Browse files
authored
Merge pull request #14647 from fiws/patch-1
docs: add note about parallelism in transations
2 parents 7e41e0e + 77083a5 commit 563f293

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

docs/transactions.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ await db.transaction(async function setRank(session) {
6161
doc.isNew;
6262
```
6363

64+
<h2 id="note-about-parallelism-in-transactions"><a href="#note-about-parallelism-in-transactions">Note About Parallelism in Transactions</a></h2>
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.
68+
6469
<h2 id="with-mongoose-documents-and-save"><a href="#with-mongoose-documents-and-save">With Mongoose Documents and <code>save()</code></a></h2>
6570

6671
If you get a [Mongoose document](documents.html) from [`findOne()`](api/model.html#model_Model-findOne)

0 commit comments

Comments
 (0)