MongoDB的优点和缺点?[英] Pros and cons of MongoDB?







  • 无模式.如果您有灵活的模式,这是像文档商店这样的理想选择 mongodb.这很难以RDBMS的性能方式实现
  • 易于扩展.比例尺读取使用副本集.比例尺使用碎片(自动平衡)写入.只需启动另一台机器,就走了.添加更多机器=添加更多的RAM,以分发您的工作集.
  • 成本.取决于当然是哪个RDBM,但是MongoDB是免费的,并且可以在Linux上运行,非常适合在较便宜的商品套件上运行.
  • 您可以根据数据的值选择想要的一致性级别(例如,更快的性能= fire and忘记插入到mongodb,shower performance = wait til til insert已在返回之前将多个节点复制到多个节点)
  • ))


  • MongoDB中的数据大小通常由于例如.每个文档都有存储的字段名称
  • 与查询更少的灵活性(例如,没有加入)
  • 不支持交易 - 在单个文档级别上支持某些原子操作
  • 目前的地图/降低(例如进行聚合/数据分析)是可以的,但并不快.因此,如果需要的话,可能需要将Hadoop之类的东西添加到混音中
  • 更少的最新信息可用/快速发展的产品

我最近想法在MongoDB上是来自SQL Server背景的人,因此您可能对此感兴趣(以上只是一些要点).

如果您正在寻找"比rdbms更好"的答案 - 那么恕我直言,没有答案.像MongoDB这样的NOSQL技术提供了一种补充RDBMS技术的替代方案.一个人可能比另一个更适合特定目的,因此,这一切都是为了呼吁您最适合您的要求.



Could anybody tell me what is the pros and cons of mongodb, especially comparing with the relational database? including ACID, scalability, throughput, main memory usage, insert/query performance and index size etc.


Some general points on MongoDB


  • schema-less. If you have a flexible schema, this is ideal for a document store like MongoDB. This is difficult to implement in a performant manner in RDBMS
  • ease of scale-out. Scale reads by using replica sets. Scale writes by using sharding (auto balancing). Just fire up another machine and away you go. Adding more machines = adding more RAM over which to distribute your working set.
  • cost. Depends on which RDBMS of course, but MongoDB is free and can run on Linux, ideal for running on cheaper commodity kit.
  • you can choose what level of consistency you want depending on the value of the data (e.g. faster performance = fire and forget inserts to MongoDB, slower performance = wait til insert has been replicated to multiple nodes before returning)


  • Data size in MongoDB is typically higher due to e.g. each document has field names stored it
  • less flexibity with querying (e.g. no JOINs)
  • no support for transactions - certain atomic operations are supported, at a single document level
  • at the moment Map/Reduce (e.g. to do aggregations/data analysis) is OK, but not blisteringly fast. So if that's required, something like Hadoop may need to be added into the mix
  • less up to date information available/fast evolving product

I recently blogged my thoughts on MongoDB as someone coming from SQL Server background, so you might be interested in that (above are just some of the main points).

If you're looking for a "Is MongoDB better than RDBMS" answer - then IMHO there is no answer. NoSQL technologies like MongoDB provide an alternative, that complements RDBMS technologies. One may be better suited to a particular purpose than the other, so it's all about making a call on what is best for you for a given requirement.