Hello,
Taking upon the following example of using transactions:
using IClientSessionHandle session = await _collection.Database.Client.StartSessionAsync();
await session.WithTransactionAsync(async (session, cancellationToken) =>
{
...
await _collection.InsertOneAsync(document, insertOneOptions, cancellationToken);
return true;
}
Is the insert operation included in the transaction? Or I have to pass the session to the method?
await _collection.InsertOneAsync(session, document, insertOneOptions, cancellationToken);