支持和反对从 SQL Server 迁移到 MongoDB 的原因 [英] Reasons for and against moving from SQL server to MongoDB

查看:25
本文介绍了支持和反对从 SQL Server 迁移到 MongoDB 的原因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这是一个大问题,它不是一个是或否的答案,但我们开发 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.

一些经验

  • 在使用 MongoDB 或任何文档数据库时,对存储的数据进行广泛的报告可能会更加困难,并且某些用例已将 RDBMS 和 document-db 组合用于此目的.
  • (非常)不同的查询模型.MongoDB 也不同于其他文档数据库.
  • 在开发过程中灵活更改数据格式/架构
  • 未知领域
  • 驱动程序和框架的不同成熟度
  • 快速
  • 产品和管理工具更简单(在许多方面)(与许多 RDBMS 产品相比)
  • 不再有阻抗不匹配.存储适合数据,而不是相反.
  • 减少摩擦,更直接地访问数据.
  • 与持久性更相关的域(取决于 NoRM 的 ORM级别",取决于它抽象出后端的程度.我没有使用过 NoRM,因此无法回答.)

这篇关于支持和反对从 SQL Server 迁移到 MongoDB 的原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆