我知道这是一个大问题,它不是一个是或否的答案,但我们开发 Web 应用程序并正在研究使用 MongoDB 作为我们的持久性解决方案.结合 MongoDB 和 NoRM 进行对象存储.
I know this is a big question and it's not a yes or no answer but we develop web apps and are looking into using MongoDB for our persistence solution. Combining MongoDB with NoRM for object storage.
我想问的是,您从 SQL 切换到 mongo 时遇到过哪些陷阱?什么时候 mongo 根本就不是正确的解决方案,mongodb 的优势是否足以将开发从 SQL 转移?
What I want to ask is what pitfalls have you experienced with switching from SQL to mongo? When is mongo simply not the right solution and is mongodb's advantages enough to move development from SQL?
在我看来,数据的格式应该是选择存储后端时的首要考虑因素.你有本质上是关系的数据吗?如果是这样,在文档中对数据进行建模是否是一个好主意?数据建模在文档数据库中与在关系数据库中一样重要,只是做得不同.你有多少种类型的对象,它们是如何相关的?Mongodb 中的 DBrefs 可以做到这一点,还是你会错过太多外键,这会很痛苦?您对数据的访问模式是什么?您只是在获取按字段值过滤的一种类型的数据,还是有复杂的获取模式?
In my opinion the format of your data should be the primary concern when choosing a storage backend. Do you have data that is relational in nature? If so, can it and is it a good idea to model the data in documents? Data modeling is as important in a document database as in an relational database, it just done differently. How many types of objects do you have and how are they related? Can DBrefs in Mongodb do the trick or will you miss foreign keys so much it will be painful? What are your access patterns for the data? Are you just fetching data of one type filtered by a field value, or do you have intricate fetching modes?
您需要 ACID 事务完整性吗?域是否对数据施加了很多约束?您是否需要文档数据库的可扩展性因素,或者这只是一个很酷"的东西?
Do you need ACID transactional integrity? Does the domain enforce a lot of constraints on the data? Do you need the scalability factor of a document database or is that just a "cool" thing to have?
您的一致性和数据完整性要求是什么?一些 NoSQL 解决方案,尤其是 MongoDB,为了获得性能,在写入一致性方面非常松散.NoSQL 没有统一的景观和其他产品,例如CouchDB 在这个部门还有其他特点.有些也是可调的.
What are your consistency and data integrity requirements? Some NoSQL solutions and MongoDB in particular are quite loose on the write consistency in order to get performance. NoSQL is no uniform landscape and other products, e.g. CouchDB has other characteristics in this department. Some are tunable too.
这些都是选择存储时应该考虑的问题.
These are all questions that should go into the choice of storage.
一些经验
这篇关于支持和反对从 SQL Server 迁移到 MongoDB 的原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!