-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.7.2
-
Component/s: Transactions
-
None
-
Environment:Windows 10
When we need to use code like this:
var userId = @event.UserId;
await Task.WhenAll(
CreateInitialSettings(userId),
CreateWidgets(userId),
CreatePersonalGroup(userId),
CreateIncomingMessage(userId)
);
causes error: Cannot specify 'startTransaction' on transaction 1 since it is already in progress.
All this operations go to Mongo with startTransaction: true argument, but only first operation must use this option.
This very strange behaviour in Server API and looks like crutch. (as it looks now)
Why we use session.StartTransaction() and operations must known about transaction ? Why this logic leaked from sessions to operations?
This bug is not driver bug, but you need to fix it on your side.
- causes
-
CSHARP-2476 Update documentation to be clear that sessions are not thread safe
- Closed
- is related to
-
SERVER-34052 Require 'startTransaction':true on first operation of a multi-statement transaction
- Closed