MongoDB 交易?

MongoDB transactions?(MongoDB 交易?)
本文介绍了MongoDB 交易?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

在 .NET 中使用 MongoDB 和 NoRM.

Playing around with MongoDB and NoRM in .NET.

让我困惑的事情 - 没有交易
(不能只是告诉 MongoConnection.Begin/EndTransaction 或类似的东西.

Thing that confused me - there are no transactions
(can't just tell MongoConnection.Begin/EndTransaction or something like that).

我想使用工作单元模式并在出现故障时回滚更改.

I want to use Unit of work pattern and rollback changes in case something fails.

是否还有一种干净的方法可以使用 ITransaction 丰富我的存储库?

Is there still a clean way how to enrich my repository with ITransaction?

推荐答案

MongoDB 不支持复杂的多文档事务.如果这是您绝对需要的东西,它可能不太适合您.

MongoDB doesn't support complex multi-document transactions. If that is something you absolutely need it probably isn't a great fit for you.

但是,在大多数情况下,我们发现不需要复杂的事务.MongoDB 中的所有操作在单个文档上都是原子的,我们支持很好的 更新修饰符,它使许多需要事务的操作变得容易(且快速).

In most cases, however, we've found that complex transactions aren't a requirement. All operations in MongoDB are atomic on a single document, and we support nice update modifiers, which make a lot of operations that would need a transaction easy to implement (and fast).

这篇关于MongoDB 交易?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to register System.DirectoryServices for use in SQL CLR User Functions?(如何注册 System.DirectoryServices 以在 SQL CLR 用户函数中使用?)
Query From LDAP for User Groups(从 LDAP 查询用户组)
How can I get DOMAINUSER from an AD DirectoryEntry?(如何从 AD DirectoryEntry 获取 DOMAINUSER?)
Get a list of members of a WinNT group(获取 WinNT 组的成员列表)
Get UPN or email for logged in user in a .NET web application(在 .NET Web 应用程序中获取登录用户的 UPN 或电子邮件)
Active Directory Group Membership Checking in .Net 4.5(.Net 4.5 中的 Active Directory 组成员身份检查)