Illustration Image

Cassandra.Link

The best knowledge base on Apache Cassandra®

Helping platform leaders, architects, engineers, and operators build scalable real time data platforms.

9/7/2018

Reading time:1 min

Apache Cassandra, Part 2: Cassandra vs MongoDB

by Haris Hasan

This series of posts present an introduction to Apache Cassandra. It discusses key Cassandra features, its core concepts, how it works under the hood, how it is different from other data stores, data modelling best practices with examples, and some tips & tricks.This series is not about MongoDB or even MongoDB vs Cassandra, but “How is it different from MongoDB?” is a commonly asked question when talking about Cassandra. So before going deep into Cassandra, I would like to describe some commonalities as well as key differences between the two.CommonalitiesHere are some properties which both Cassandra and MongoDB share:None of these data stores are a replacement for RDBMS.They do not provide ACID compliance.Both keep recent data in memory to improve performance.Both data stores discourage joins and prefer denormalization.Both are open source, have been in industry for quite some time, and have comprehensive support.DifferencesAt a high level, some major differences between these two stores are:MongoDB uses B-Trees under the hood for storage while Cassandra is based on LSM trees which makes Cassandra more scalable for writes.MongoDB is more closer to a RDBMS than Cassandra as you can implement concepts like relationships and joins on top of MongoDB. Same is not true for Cassandra.MongoDB supports nested objects, Cassandra does not.MongoDB offers both primary and secondary index and also allows indexing of nested properties. While Cassandra only supports primary index. [More on this later]MongoDB lets you write queries in JSON format and allow all kinds of operators. Cassandra offers CQL which only supports limited operators and use of these operators also depend on how you have defined the schema.MongoDB provides built-in aggregation, which works well for small to medium sized databases, Cassandra has no such feature.MongoDB does not enforce schema on write, Cassandra prefers design time schema.MongoDB is document based store which is somewhat similar to rows in a table, Cassandra on the other hand is a column family store (and not a column oriented store, more on this later).Cassandra provides high write availability through its master-less or multi master architecture as compared to MongoDB which works on master slave architecture. (More on this later)Cassandra provides linear write scalability which is not the case with MongoDB.Next: Apache Cassandra, Part 3: Row vs Column Stores

Illustration Image

This series of posts present an introduction to Apache Cassandra. It discusses key Cassandra features, its core concepts, how it works under the hood, how it is different from other data stores, data modelling best practices with examples, and some tips & tricks.

image

This series is not about MongoDB or even MongoDB vs Cassandra, but “How is it different from MongoDB?” is a commonly asked question when talking about Cassandra. So before going deep into Cassandra, I would like to describe some commonalities as well as key differences between the two.

Commonalities

Here are some properties which both Cassandra and MongoDB share:

  • None of these data stores are a replacement for RDBMS.
  • They do not provide ACID compliance.
  • Both keep recent data in memory to improve performance.
  • Both data stores discourage joins and prefer denormalization.
  • Both are open source, have been in industry for quite some time, and have comprehensive support.

Differences

At a high level, some major differences between these two stores are:

  • MongoDB uses B-Trees under the hood for storage while Cassandra is based on LSM trees which makes Cassandra more scalable for writes.
  • MongoDB is more closer to a RDBMS than Cassandra as you can implement concepts like relationships and joins on top of MongoDB. Same is not true for Cassandra.
  • MongoDB supports nested objects, Cassandra does not.
  • MongoDB offers both primary and secondary index and also allows indexing of nested properties. While Cassandra only supports primary index. [More on this later]
  • MongoDB lets you write queries in JSON format and allow all kinds of operators. Cassandra offers CQL which only supports limited operators and use of these operators also depend on how you have defined the schema.
  • MongoDB provides built-in aggregation, which works well for small to medium sized databases, Cassandra has no such feature.
  • MongoDB does not enforce schema on write, Cassandra prefers design time schema.
  • MongoDB is document based store which is somewhat similar to rows in a table, Cassandra on the other hand is a column family store (and not a column oriented store, more on this later).
  • Cassandra provides high write availability through its master-less or multi master architecture as compared to MongoDB which works on master slave architecture. (More on this later)
  • Cassandra provides linear write scalability which is not the case with MongoDB.

Next: Apache Cassandra, Part 3: Row vs Column Stores

Related Articles

mongo
rest
cassandra

GitHub - stargate/stargate: An open source data gateway

John Doe

3/7/2024

Checkout Planet Cassandra

Claim Your Free Planet Cassandra Contributor T-shirt!

Make your contribution and score a FREE Planet Cassandra Contributor T-Shirt! 
We value our incredible Cassandra community, and we want to express our gratitude by sending an exclusive Planet Cassandra Contributor T-Shirt you can wear with pride.

Join Our Newsletter!

Sign up below to receive email updates and see what's going on with our company

Explore Related Topics

AllKafkaSparkScyllaSStableKubernetesApiGithubGraphQl

Explore Further

mongo

article

cassandra
article