Are MongoDB and CouchDB perfect substitutes?

MongodbCouchdbDatabase

Mongodb Problem Overview


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 (images 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!

Mongodb Solutions


Solution 1 - Mongodb

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

Solution 2 - Mongodb

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.

Solution 3 - Mongodb

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.

Solution 4 - Mongodb

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.

Solution 5 - Mongodb

Solution 6 - 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).

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionraoulssonView Question on Stackoverflow
Solution 1 - MongodbrfundukView Answer on Stackoverflow
Solution 2 - MongodbmikealView Answer on Stackoverflow
Solution 3 - MongodbJan LehnardtView Answer on Stackoverflow
Solution 4 - MongodbClint MillerView Answer on Stackoverflow
Solution 5 - MongodbTheoView Answer on Stackoverflow
Solution 6 - MongodbUbertoView Answer on Stackoverflow