Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-2473

Multiple startTransaction: true for simultaneous operations

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            zoxexivo@gmail.com Ivan Artemov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: