CouchDB or MongoDB (or Cassandra)?

2,128 views
Skip to first unread message

Will Gillen

unread,
Jan 23, 2012, 10:06:40 AM1/23/12
to nod...@googlegroups.com
I'm just starting to get my feet wet with Node.js and NoSQL databases, and I have been researching which database route to take strictly for learning purposes.  I have read up fairly extensively on both CouchDB and MongoDB (I haven't read much yet on Cassandra, and I don't even know if there is a module available in Node yet for Cassandra?).  I have a pretty good understanding of the various differences between the two DBMSs MongoDB and CouchDB.  I would like to get a feel from the community here on which DBMSs most people are using, and under what use-cases?  For my work, I have no specific project yet; I just want to see what everyone here is using before I decide to pick a platform to work with.

Thanks!  (and, this is my first post to this group).

-- Will G.

Mikeal Rogers

unread,
Jan 23, 2012, 7:57:03 PM1/23/12
to nod...@googlegroups.com
you are in luck sir!

we did a database deep dive on last week's NodeUp


:)

--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Alexey Petrushin

unread,
Jan 23, 2012, 8:42:54 PM1/23/12
to nod...@googlegroups.com
MongoDB for getting things done, CouchDB for learning interesting DB technics.

Mark Hahn

unread,
Jan 23, 2012, 9:01:19 PM1/23/12
to nod...@googlegroups.com
I've used Couch for a year.  After hearing so much about mongo I tried to switch.  I was unable to because there is no way to monitor changes in mongo.  I also was not happy with how complicated mongo was for replication and scaling.  To scale you have to use sharding.  Replication is master slave which I happily left behind years ago.

The bottom line is couch is much simpler and works well.

Message has been deleted

Alexey Petrushin

unread,
Jan 23, 2012, 9:11:41 PM1/23/12
to nod...@googlegroups.com
Hmm, CouchDB seems to me too alien for common web-dev, is there a way to do comments count for example (and read it back in SINGLE query)?

Karl Tiedt

unread,
Jan 23, 2012, 9:18:30 PM1/23/12
to nod...@googlegroups.com
a view in Couch returns record count as part of the query...

-Karl Tiedt

Alexey Petrushin

unread,
Jan 23, 2012, 9:27:47 PM1/23/12
to nod...@googlegroups.com
Not quite get it, yes it's possible to create a view that will display a count of comments but it's not what usually needed.

I mean let's say we need a Blog application, there's a Post and each post has a lots of Comments.
First page of Blog displays first 10 posts, with comments count for each.

How to do it? How can I query last 10 posts & comments count for each in single query?

Joe Stein

unread,
Jan 23, 2012, 9:58:21 PM1/23/12
to nod...@googlegroups.com
if you are trying to make the decision then maybe MySQL is your best choice until you find specific problems that deem a new system with new problems

MySQL is great!!!  if you you find problems with it you are likely to find more problems with other newer systems just not the same problems.... while I appreciate, work with and promote systems like Cassandra & HBase (and Mongo for specific use cases on occasion) it continues to boggle me how MySQL is not the goto system for basic web development and basic types of distributed systems even... by I digress.

to answer your question, yes Cassandra has a nodejs CQL client http://code.google.com/a/apache-extras.org/p/cassandra-node/ as well as a thrift client https://github.com/wadey/node-thrift you could build your own client bindings to Cassandra or whatever you want that supports thrift for that matter.

good luck.

--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Karl Tiedt

unread,
Jan 23, 2012, 10:09:05 PM1/23/12
to nod...@googlegroups.com
For something like that you would have to design your documents in a
way to fit couch... IE, a post document that contains a comments
Array... then... you can achieve that... its not to say its the most
efficient use of resources or the best way to achieve it... but its
possible.

Design is important when you are working with databases ;)

-Karl Tiedt

Mark Hahn

unread,
Jan 23, 2012, 10:15:29 PM1/23/12
to nod...@googlegroups.com
I mean let's say we need a Blog application, there's a Post and each post has a lots of Comments.
First page of Blog displays first 10 posts, with comments count for each.

There are several ways to do it.  You have to shift your thinking with nosql.  

One of my biggest problems when I started was that I kept trying to think like I did for sql.  Nosql is much simpler than sql and you have to think in the simpler way.  You do less normalizing and you do multiple accesses where in sql you do one.  It so much faster that you come out ahead.

Jeff Barczewski

unread,
Jan 24, 2012, 11:31:06 AM1/24/12
to nod...@googlegroups.com
If you can live without the monitoring of changes to data, then mongo is my choice.

In the tests we have done, Mongo was much faster than Couch.

I was impressed at how easy it was to get up and running with it. 

Jeff



Jeremy Darling

unread,
Jan 24, 2012, 11:48:40 AM1/24/12
to nod...@googlegroups.com
My own two cents based solely on a single production deployment (parallel deploy to see what worked better):

If you have LOTS of writes vs few reads, Couch's master-master works better.  If you have minimal writes with LOTS of reads, then Mongo's master-slave with "write guarantees" from MongoS is better.
If you like the concept of tables then Mongo will feel better, if you like the idea of throw everything in one place then Couch will feel better.

They both weighed the same and taxed systems about the same, but Couch's multi-master inserts under large load out-performed Mongo's.  Couch completely failed though when it came to massive reads (ensuring concurrency) compared to Mongo.

In the end as our needs were mainly reads with minimal writes we chose Mongo.  We also already had a complete Data Services team that took comfort in the Collections as Tables (one way to sell NoSQL to strict RDBMS guys).

 - Jeremy


john tigernassau

unread,
Jan 24, 2012, 12:23:12 PM1/24/12
to nod...@googlegroups.com

We use both Mongo and Couch, though now mostly using Couch - Cassandra is strictly key value and we thought too low level for our needs.  We like both Mongo and Couch for different reasons.  Both are easy to use with json - just read it in and out (json store in nosql is so much nicer than typical sql) 

Mongo is fast, and much simpler to write queries than in Couch with it's map-reduce.  Couch has the great REST interface and much easier replication.  We are mostly using couch due to integration with Backbone and Couchapp and mobile local data store.  We also like couch being in a pure open source foundation

James Carr

unread,
Jan 24, 2012, 7:27:25 PM1/24/12
to nod...@googlegroups.com

One thing I always liked about mongo is being able to run "queries" without having to resort to map reduce.

I think it all really boils down to the needs of your app though.

Thanks,
James

Mark Hahn

unread,
Jan 24, 2012, 8:12:02 PM1/24/12
to nod...@googlegroups.com
An oversimplification is that mongo is half-way between mysql and couch in terms of how you use it.  It has json documents like couch but queries like mysql.  

Mongo has the mysql restrictions in regards to replication and scaling.   Couch scales and replicates with ease.  

Mongo offers consistency like myqsql and couch doesn't (which is why couch scales so easily).

Couch is also faster in querying since the request goes straight to the view b-tree and then optionally directly to the file position.  Mongo has to do query optimization like mysql and hit an arbitrary number of indexes.

Mongo suffers from db corruption in crashes like mysql, couch doesn't.

Michael Pantaleo

unread,
Jan 24, 2012, 9:20:53 PM1/24/12
to nodejs
Will,

In addition to the three NoSQL databases that you mentioned, may I
also recommend that you take a look at Globals, as it also fully
support Node.js as an interface to the database: http://GlobalsDB.org/

Good luck with your investigation :)

Cheers,
Michael P.

Alexey Petrushin

unread,
Jan 25, 2012, 1:15:58 PM1/25/12
to nod...@googlegroups.com
> Couch scales and replicates with ease.
I heard that in sharded mode CouchDB sends every view query to ALL shards and then sharding-proxy joins the results. 
It seems that such architecture isn't scalable in terms of query throughput.

Diogo Resende

unread,
Jan 25, 2012, 1:22:19 PM1/25/12
to nod...@googlegroups.com

I believe that is not even what sharding is. That looks like
replication.

---
Diogo R.

Mark Hahn

unread,
Jan 25, 2012, 2:01:33 PM1/25/12
to nod...@googlegroups.com
>  I heard that in sharded mode CouchDB sends every view query to ALL shards  

There is no shard mode.  Couch doesn't handle sharding itself.  It is up to an app to do that.  It does offer the feature that replication can be filtered, which would help sharding.

So the solution you are referring to must be a sharding tool of which I'm not aware.  If I were to do sharding I certainly would only send the request to the one server based on the hash.

Alexey Petrushin

unread,
Jan 25, 2012, 2:22:44 PM1/25/12
to nod...@googlegroups.com
> There is no shard mode.
Yes, I mean sharding done via third-party tool, the CouchDB Lounge. http://guide.couchdb.org/editions/1/en/clustering.html

Mark Hahn

unread,
Jan 25, 2012, 2:40:44 PM1/25/12
to nod...@googlegroups.com
Yes, I mean sharding done via third-party tool, the CouchDB Lounge 

If it is querying every server then it must be supporting arbitrary DBs without any sharding hash.  It's hard to believe they would do that.  

It would be quite simple to use a shard key and do it right.  The algorithm to generate the hash would have to be used by any client that accesses the db.  Maybe they are trying to avoid that.

I do know that mongo db has to hit every server and bring all results through a proxy when doing arbitrary queries on shards.  There is no way around that.

Alexey Petrushin

unread,
Jan 28, 2012, 5:50:06 PM1/28/12
to nod...@googlegroups.com

Azer Koçulu

unread,
Jan 29, 2012, 2:22:22 AM1/29/12
to nod...@googlegroups.com

Hi Will

I ve been working on multiplayerchess.com for a while.

It's a nodejs and couchdb app. I really enjoyed the time I spent with couchdb but I'm switching to mongo for better performance and community support.

Since the work i'm talking about is oss, you can also check the source codes out if you're interested;

http://github.com/azer/multiplayerchess.com

http://github.com/azer/api.multiplayerchess.com

Second one is the new mongo app.

Best,

Azer

--

Mark Hahn

unread,
Jan 29, 2012, 3:07:22 PM1/29/12
to nod...@googlegroups.com
How do you notify other users when the db (chessboard) changes?  I use couch doc-change watching to do that and that is why I ended up not switching to mongo.  That and the lack of replication.

Axel Kittenberger

unread,
Jan 29, 2012, 6:49:31 PM1/29/12
to nod...@googlegroups.com
I suppose you still think in the PHP/MySQL architecture where one
client had one PHP process, and theses needed to communicate with each
other somehow, most often done over the database. Why need to notifiy
over the database, if you are using node.js? You have only one
server-side process that accesses the database anyway, so any
cross-client notification mechanisms would be simply be done within
the node process. And speaking of chess, why you need a database at
all? Its 64 fields worth of memory use.

Mark Hahn

unread,
Jan 29, 2012, 7:37:03 PM1/29/12
to nod...@googlegroups.com
You have only one server-side process that accesses the database anyway

Well, actually I have 3 processes per server and multiple servers.  So using a replicated db is mandatory.  Couch is perfect for this.

> And speaking of chess, why you need a database at all? Its 64 fields worth of memory use. 

That's fine if you only have one server and don't care if a server or process reboots losing in-progress games.  Or do you back up to disk on every chess move?  If  you do back up, then why not use a db?

Azer Koçulu

unread,
Jan 30, 2012, 3:29:22 AM1/30/12
to nod...@googlegroups.com

Sorry for this late reply. The chess app needs a db to keep all games available to be played and replayed anytime.

Maarten Oelering

unread,
Jan 31, 2012, 3:16:56 AM1/31/12
to nodejs
The following (e-)book from Pragmatic Programmers describes MongoDB
and CouchDB in detail, and highlights their USPs.

Seven Databases in Seven Weeks: A Guide to Modern Databases and the
NoSQL Movement
by Eric Redmond and Jim R. Wilson

Unfortunately, Cassandra is not descibed in the book, but another
column-oriented database is, HBase.

Maarten

Tyler

unread,
Feb 10, 2012, 7:54:01 PM2/10/12
to nodejs
Is it possible to get some sort of transcript for this? Or is that
too tall of an order? It sounds pretty cool but I never retain all
that much verbally as opposed to visually....

Tyler



On Jan 23, 4:57 pm, Mikeal Rogers <mikeal.rog...@gmail.com> wrote:
> you are in luck sir!
>
> we did a database deep dive on last week's NodeUp
>
> http://nodeup.com/eleven
>
> :)
>
> On Jan 23, 2012, at January 23, 20127:06 AM, Will Gillen wrote:
>
>
>
>
>
>
>
> > I'm just starting to get my feet wet with Node.js and NoSQL databases, and I have been researching which database route to take strictly for learning purposes.  I have read up fairly extensively on both CouchDB and MongoDB (I haven't read much yet on Cassandra, and I don't even know if there is a module available in Node yet for Cassandra?).  I have a pretty good understanding of the various differences between the two DBMSs MongoDB and CouchDB.  I would like to get a feel from the community here on which DBMSs most people are using, and under what use-cases?  For my work, I have no specific project yet; I just want to see what everyone here is using before I decide to pick a platform to work with.
>
> > Thanks!  (and, this is my first post to this group).
>
> > -- Will G.
>

Lothar Pfeiler

unread,
Feb 12, 2012, 12:55:56 PM2/12/12
to nodejs
The replication feature of couchdb is very alluring. Plus, I like to
replicate with mobile devices. Which brings me to my concern regarding
CouchDB. There is now Couchbase Server and CouchDB. In my evaluation
of MongoDB vs CouchDB this is a risk. How do you look at it?

Lothar

On Feb 11, 1:54 am, Tyler <tyler.che...@gmail.com> wrote:
> Is it possible to get some sort of transcript for this?   Or is that
> too tall of an order?   It sounds pretty cool but I never retain all
> that much verbally as opposed to visually....
>
> Tyler
>
> On Jan 23, 4:57 pm, Mikeal Rogers <mikeal.rog...@gmail.com> wrote:
>
>
>
>
>
>
>
> > you are in luck sir!
>
> > we did a database deep dive on last week's NodeUp
>
> >http://nodeup.com/eleven
>
> > :)
>
> > On Jan 23, 2012, at January 23, 20127:06 AM, Will Gillen wrote:
>
> > > I'm just starting to get my feet wet with Node.js and NoSQL databases, and I have been researching which database route to take strictly for learning purposes.  I have read up fairly extensively on bothCouchDBand MongoDB (I haven't read much yet on Cassandra, and I don't even know if there is a module available in Node yet for Cassandra?).  I have a pretty good understanding of the various differences between the two DBMSs MongoDB andCouchDB.  I would like to get a feel from the community here on which DBMSs most people are using, and under what use-cases?  For my work, I have no specific project yet; I just want to see what everyone here is using before I decide to pick a platform to work with.

Kevin Swiber

unread,
Feb 12, 2012, 1:45:55 PM2/12/12
to nod...@googlegroups.com
On Sun, Feb 12, 2012 at 12:55 PM, Lothar Pfeiler <lpfe...@googlemail.com> wrote:
The replication feature of couchdb is very alluring. Plus, I like to
replicate with mobile devices. Which brings me to my concern regarding
CouchDB. There is now Couchbase Server and CouchDB. In my evaluation
of MongoDB vs CouchDB this is a risk. How do you look at it?

At this point, Couchbase is closer to Membase than CouchDB.

When Couchbase 2.0 is released to a general audience, it will bring some of those lovely features of CouchDB.  Throw in their Mobile Syncpoint offering, and it's pretty solid.

You can certainly be an early adopter, but I would expect the occasional roadblock that comes along with that.  Personally, I have high hopes that Couchbase 2.0 will rock the house.  However, if I had to invest in implementing a document database for a production system today, it would be Apache CouchDB, MongoDB, or Riak, depending on the requirements. 

Couchbase is definitely something to keep an eye on going forward, but it's just not where I'd like it to be for production use.
 
--
Kevin Swiber
Projects: https://github.com/kevinswiber
Twitter: @kevinswiber

Reply all
Reply to author
Forward
0 new messages