何时在MongoDB上使用CouchDB,反之亦然

本文翻译自:When to use CouchDB over MongoDB and vice versa

I am stuck between these two NoSQL databases. 我被困在这两个NoSQL数据库之间。

In my project I will be creating a database within a database. 在我的项目中,我将在数据库中创建一个数据库。 For example, I need a solution to create dynamic tables. 例如,我需要一个创建动态表的解决方案。

So users can create tables with columns and rows. 因此用户可以创建包含列和行的表。 I think either MongoDB or CouchDB will be good for this, but I am not sure which one. 我认为MongoDB或CouchDB对此都有好处,但我不确定是哪一个。 I will also need efficient paging as well. 我也需要高效的分页。


#1楼

参考:https://stackoom.com/question/qBdW/何时在MongoDB上使用CouchDB-反之亦然


#2楼

I'm sure you can with Mongo (more familiar with it), and pretty sure you can with couch too. 我相信你可以使用Mongo(更熟悉它),并且非常确定你也可以用沙发。

Both are documented oriented (JSON-based) so there would be no "columns" but rather fields in documents -- but they can be fully dynamic. 两者都是面向文档的(基于JSON),因此没有“列”而是文档中的字段 - 但它们可以是完全动态的。

They both do it you may want to look at other factors on which to use: other features you care about, popularity, etc. Google insights, indeed.com job posts would be ways to look at popularity. 他们都这样做你可能想看看其他使用的因素:你关心的其他功能,受欢迎程度等。谷歌见解,Indeed.com工作岗位将是看待受欢迎程度的方法。

You could just try it i think you should be able to have mongo running in 5 minutes. 你可以尝试一下我认为你应该可以在5分钟内运行mongo。


#3楼

Of C, A & P (Consistency, Availability & Partition tolerance) which 2 are more important to you? C,A&P(一致性,可用性和分区容差)哪两个对您更重要? Quick reference, the Visual Guide To NoSQL Systems 快速参考, NoSQL系统可视化指南

  • MongodB : Consistency and Partition Tolerance MongodB:一致性和分区容差
  • CouchDB : Availability and Partition Tolerance CouchDB:可用性和分区容差

A blog post, Cassandra vs MongoDB vs CouchDB vs Redis vs Riak vs HBase vs Membase vs Neo4j comparison has ' Best used ' scenarios for each NoSQL database compared. 一篇博客文章, Cassandra vs MongoDB vs CouchDB vs Redis vs Riak vs HBase vs Membase vs Neo4j比较每个NoSQL数据库的“ 最佳使用 ”场景比较。 Quoting the link, 引用链接,

  • MongoDB: If you need dynamic queries. MongoDB:如果需要动态查询。 If you prefer to define indexes, not map/reduce functions. 如果您更喜欢定义索引,而不是map / reduce函数。 If you need good performance on a big DB. 如果你需要在大数据库上有良好的性能。 If you wanted CouchDB, but your data changes too much, filling up disks. 如果你想要CouchDB,但你的数据变化太大,填满了磁盘。
  • CouchDB : For accumulating, occasionally changing data, on which pre-defined queries are to be run. CouchDB:用于累积,偶尔更改数据,以运行预定义的查询。 Places where versioning is important. 版本控制很重要的地方。

A recent (Feb 2012) and more comprehensive comparison by Riyad Kalla, Riyad Kalla最近(2012年2月)和更全面的比较

  • MongoDB : Master-Slave Replication ONLY MongoDB:仅主从复制
  • CouchDB : Master-Master Replication CouchDB:主 - 主复制

A blog post (Oct 2011) by someone who tried both, A MongoDB Guy Learns CouchDB commented on the CouchDB's paging being not as useful. 一篇博客文章(2011年10月)是一位尝试过这两篇文章的人, A MongoDB Guy Learns CouchDB对CouchDB的分页发表评论并不是很有用。

A dated (Jun 2009) benchmark by Kristina Chodorow ( part of team behind MongoDB ), Kristina ChodorowMongoDB背后的团队成员 )的日期(2009年6月) 基准测试

I'd go for MongoDB. 我会去MongoDB。

Hope it helps. 希望能帮助到你。


#4楼

Be aware of an issue with sparse unique indexes in MongoDB. 请注意MongoDB中稀疏唯一索引的问题。 I've hit it and it is extremely cumbersome to workaround. 我已经打了它,解决方法非常麻烦。

The problem is this - you have a field, which is unique if present and you wish to find all the objects where the field is absent. 问题是这样的 - 你有一个字段,如果存在,它是唯一的,你希望找到字段不存在的所有对象。 The way sparse unique indexes are implemented in Mongo is that objects where that field is missing are not in the index at all - they cannot be retrieved by a query on that field - {$exists: false} just does not work. 在Mongo中实现稀疏唯一索引的方式是缺少该字段的对象根本不在索引中 - 它们无法通过该字段上的查询检索 - {$exists: false}只是不起作用。

The only workaround I have come up with is having a special null family of values, where an empty value is translated to a special prefix (like null: ) concatenated to a uuid. 我提出的唯一解决方法是使用一个特殊的null值系列,其中空值转换为连接到uuid的特殊前缀(如null :)。 This is a real headache, because one has to take care of transforming to/from the empty values when writing/quering/reading. 这是一个真正的头痛,因为在编写/查询/阅读时,必须注意转换为空值或从空值转换。 A major nuisance. 一个主要的滋扰。

I have never used server side javascript execution in MongoDB (it is not advised anyway) and their map/reduce has awful performance when there is just one Mongo node. 我从来没有在MongoDB中使用服务器端javascript执行(无论如何都不建议),当只有一个Mongo节点时,它们的map / reduce性能很差。 Because of all these reasons I am now considering to check out CouchDB, maybe it fits more to my particular scenario. 由于所有这些原因,我现在正在考虑查看CouchDB,也许它更符合我的特定情况。

BTW, if anyone knows the link to the respective Mongo issue describing the sparse unique index problem - please share. 顺便说一句,如果有人知道描述稀疏唯一索引问题的相应Mongo问题的链接 - 请分享。


#5楼

I summarize the answers found in that article: 我总结了那篇文章中的答案:

http://www.quora.com/How-does-MongoDB-compare-to-CouchDB-What-are-the-advantages-and-disadvantages-of-each http://www.quora.com/How-does-MongoDB-compare-to-CouchDB-What-are-the-advantages-and-disadvantages-of-each

MongoDB: Better querying, data storage in BSON (faster access), better data consistency, multiple collections MongoDB:更好的查询,BSON中的数据存储(更快的访问),更好的数据一致性,多个集合

CouchDB: Better replication, with master to master replication and conflict resolution, data storage in JSON (human-readable, better access through REST services), querying through map-reduce. CouchDB:更好的复制,主从复制和冲突解决,JSON中的数据存储(人类可读,通过REST服务更好地访问),通过map-reduce查询。

So in conclusion, MongoDB is faster, CouchDB is safer. 总而言之,MongoDB更快,CouchDB更安全。

Also: http://nosql.mypopescu.com/post/298557551/couchdb-vs-mongodb 另外: http//nosql.mypopescu.com/post/298557551/couchdb-vs-mongodb


#6楼

The answers above all over complicate the story. 上面的答案使故事复杂化。

  1. If you plan to have a mobile component, or need desktop users to work offline and then sync their work to a server you need CouchDB. 如果您计划拥有移动组件,或者需要桌面用户脱机工作,然后将其工作同步到服务器,则需要使用CouchDB。
  2. If your code will run only on the server then go with MongoDB 如果您的代码只在服务器上运行,那么请使用MongoDB

That's it. 而已。 Unless you need CouchDB's (awesome) ability to replicate to mobile and desktop devices, MongoDB has the performance, community and tooling advantage at present. 除非您需要CouchDB(非常棒)复制到移动和桌面设备的能力,否则MongoDB目前具有性能,社区和工具优势。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值