Using MongoDB C# Driver (official form 10gen), I’m doing the following code:
using (database.RequestStart()) {
collection.Save(object);
}
I would want to know how to stop the request and rollback the existing performed operations after the RequestStart()method.
Thanks in advance, guys!
Well, I searched across the web and found these methods only increase connection performance, but doesn’t stores any operation.
The concept of MongoDB operations are performed with a single-by-single operation.
The
RequestStart()method only gets the current connection state for reusing it. If no existing connection are open, it opens a new connection and tell to driver that all the following operations – until theRequestDone()method is called – will use the current opened connection.In other side, MongoDB have the capability to do two-phase commits, which are, in our “SQL concept”, a transaction-like pattern. In this case, the MongoDB C# Driver needs to implement this pattern, or we can do it ourselves developing command adapters.