File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -369,6 +369,11 @@ export class ClientSession extends TypedEventEmitter<ClientSessionEvents> {
369
369
/**
370
370
* Starts a new transaction with the given options.
371
371
*
372
+ * @remarks
373
+ * **IMPORTANT**: Running operations in parallel is not supported during a transaction. The use of `Promise.all`,
374
+ * `Promise.allSettled`, `Promise.race`, etc to parallelize operations inside a transaction is
375
+ * undefined behaviour.
376
+ *
372
377
* @param options - Options for the transaction
373
378
*/
374
379
startTransaction ( options ?: TransactionOptions ) : void {
@@ -449,6 +454,10 @@ export class ClientSession extends TypedEventEmitter<ClientSessionEvents> {
449
454
* - If the transaction is manually aborted within the provided function it will not throw.
450
455
* - If the driver needs to attempt to retry the operations, the provided function may be called multiple times.
451
456
*
457
+ * **IMPORTANT:** Running operations in parallel is not supported during a transaction. The use of `Promise.all`,
458
+ * `Promise.allSettled`, `Promise.race`, etc to parallelize operations inside a transaction is
459
+ * undefined behaviour.
460
+ *
452
461
* Checkout a descriptive example here:
453
462
* @see https://www.mongodb.com/blog/post/quick-start-nodejs--mongodb--how-to-implement-transactions
454
463
*
You can’t perform that action at this time.
0 commit comments