Cassandra Vs Mongodb
Cassandra vs MongoDB
Akbar S. Ahmed | Jan 22, 2015

Comparing two leading NoSQL databases

This post provides a brief technical comparison of Apache Cassandra and MongoDB. At Exponential.io, we use and like both databases so we’ll focus on what makes each unique and different.

Our view on databases is that a multi-database approach is often best. More often than not, using a single database results in using the wrong technology to address a given product need. In our experience, learning how to use each database for use cases that it addresses best is easier than trying to hack one database for all use cases (especially those that it’s particularly bad at).

To simplify a mult-database approach for other engineering layers, such as Platform Services and UX, we recommend the creation of a Data Services API. The Data Services API provides a standard REST API as the way for engineers outside of Data Services to query data without the need to know which database is used for persistence.

With that said, let’s get onto the comparison.

Feature Cassandra MongodB
Type Wide-column Document-oriented
Query language CQL Custom, JavaScript-based objects and methods
Failover Masterless, token ring Master/slave
Storage Sorted strings BSON
Primary indexes Yes Yes
Secondary indexes Sort of1 Yes
Sharding Yes Yes
Ad-hoc queries No Yes
JOIN No2 No2
ORDER BY Yes, via clustering columns Yes
Update in place No Yes
Ease of setup Easy Easy
Fault tolerance Exceptionally high High
Schema Yes, via CQL Optional in client
Consistency Tunable Yes
Open source Yes Yes
  1. While Cassandra technically has secondary indexes, it’s a feature that should rarely, if ever, be used. Best practice with Cassandra is to model the data such that secondary indexes are not needed, which is easy and feasible given Cassandra fast writes.
  2. While neither database directly supports JOIN operations, you can gain equivalent functionality in each.



Subscribe to our newsletter

Contact Information

ABOUT EXPONENTIAL.IO

We specialize in helping professional developers, like you, expand your skill set. Our courses are focused on enabling you to learn everything necessary to use a new technology in a live, production application.

LOCATION

All courses are made with love in
Palo Alto, CA.

Subscribe to our newsletter