Hi.
In your manual
write about if get database from session its retrive database with the session
I also get database from session but transaction dont work. what is problem ?
var _client = new MongoClient("mongodb://localhost");
using (var session = _client.StartSession())
{
session.StartTransaction();
var col = session.Client.GetDatabase("a").GetCollection<c>("c");
var m = new MyClass { };
col.InsertOne(m);
Thread.Sleep(TimeSpan.FromSeconds(5));
session.CommitTransaction();
}
Here we see that the collection seems to be working with its own session. Ignored session and transaction.
I don’t understand is this a driver bug or an error in the manual? Or is there really no other way to add a session to a parameter in every query?
col.InsertOne(session, m);