Skip to content

Commit

Permalink
Merge pull request #14647 from fiws/patch-1
Browse files Browse the repository at this point in the history
docs: add note about parallelism in transations
  • Loading branch information
vkarpov15 authored Jun 4, 2024
2 parents 7e41e0e + 77083a5 commit 563f293
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ await db.transaction(async function setRank(session) {
doc.isNew;
```

<h2 id="note-about-parallelism-in-transactions"><a href="#note-about-parallelism-in-transactions">Note About Parallelism in Transactions</a></h2>

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
undefined behaviour and should be avoided.

<h2 id="with-mongoose-documents-and-save"><a href="#with-mongoose-documents-and-save">With Mongoose Documents and <code>save()</code></a></h2>

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

0 comments on commit 563f293

Please sign in to comment.