开发者

Are MongoDB and CouchDB perfect substitutes?

I haven't got my hands dirty yet with neither CouchDB nor MongoDB but I would like to do so soon... I also have read a bit about both systems and it looks to me like they cover the same cases... Or am I missing a key distinguishing feature?

I would like to use a document based storage instead of a traditional RDBMS in my next project. I also need the datastore to

  • handle large binary objects (开发者_StackOverflowimages and videos)
  • automatically replicate itself to physically separate nodes
  • rendering the need of an additional RDBMS superfluous

Are both equally well suited for these requirements?

Thanks!


I've actually used both pretty extensively, both for very different projects.

I'd say they are equally well suited for the requirements you list, however there are quite a lot of differences between the two. IMO the biggest is their query-ability. CouchDB doesn't have 'queries' in the RDBMS sense (select * from ...) but instead uses 'views' which are more like stored procedures (essentially, static queries defined in the database (1)). MongoDB has much more 'usual' querying.

Essentially it comes down to your application requirements. If you give more information I might be able to shed some more light on what might matter in that situation.

(1): you can have temporarily, non-static queries in CouchDB but they aren't recommended for production use


Mongo uses more "traditional" queries. You turn on indexing on a per-key basis and use a SQLish query syntax.

CouchDB's views can do much deeper indexing and relationships but require you to do a little more work and understand the way the key sorting works for doing the queries.

There is a big difference in the replication systems as well. Mongo's replication looks a lot like most RDBMS solutions with masters and slaves and all that. CouchDB's replication is more peer to peer, no master/slave, every CouchDB is a node.


CouchDB's replication is made for keeping geographically apart sites in sync. It handles network- and other errors gracefully by restarting replication where it left off. Participating nodes can even be put offline deliberately.


Before using MongoDB, I'd recommend that you take a look at the following: http://groups.google.com/group/mongodb-user/browse_thread/thread/460dbd49a5b6b267. MongoDB has a small chance of corrupting data due to its lack of fsync's with each write.


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


From a developer point of view the biggest difference is the mongo live queries vs couch view (which must be "compiled"). From an operational point of view, couch is working completely on http-rest. If you're able to configure http servers you know how to setup coach. With Mongo instead you have to learn how to set up config servers, replica set and mongos (kind of balancer).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜