MongoDB C# Driver support for .Net System.Transactions

1,581 views
Skip to first unread message

sha...@chunkofwood.com

unread,
Aug 2, 2013, 6:03:52 PM8/2/13
to mongod...@googlegroups.com
Hello,

Does the MongoDB C# Driver currently support, or are there any plans to support, .Net transactions? Here is an example of what I want to be able to do:

using (TransactionScope scope = new TransactionScope())
{
    MongoCollection collection = server.GetCollection(“users”);
   
    User user = collection.FindOneAs<User>(query);
    user1.Name = “John Doe”;
    collection.Save(user1);

    User user1 = collection.FindOneAs<User>(another query);
    user2.Name = “Jane Doe”;
    collection.Save(user2);

    scope.Complete();
}

My hope is that this would queue up the Save() and any other write operations performed in that scope until I call scope.Complete(). At that point, all the operations would be performed together, in sequence. Before they run, each operation would perform some preparation and decide if the commit is likely to fail. If one of the operations decides it’s likely to fail, it would be aborted. Otherwise, they would all attempt to perform their writes. It would be acceptable risk if a failure occurred at that point.

http://msdn.microsoft.com/en-us/library/System.Transactions.aspx

Robert Stam

unread,
Aug 2, 2013, 6:19:32 PM8/2/13
to mongod...@googlegroups.com


--
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel -- freenode.net#mongodb
 
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages