A com­par­i­son between MongoDB vs. Cassandra shows many sim­i­lar­i­ties. Nev­er­the­less, both are best suited for different purposes. MongoDB’s optimal scal­a­bil­i­ty is con­vinc­ing, while the better avail­abil­i­ty is the main argument in favor of Cassandra.

MongoDB vs. Cassandra: Two of the most suc­cess­ful NoSQL databases

MongoDB and Cassandra are two of the most important NoSQL databases. They are used by numerous well-known and suc­cess­ful companies and also provide great services for users with smaller re­quire­ments.

Note

With the emergence of ever larger and more diverse data volumes, dis­trib­uted database man­age­ment systems and NoSQL databases have become in­creas­ing­ly important. These non-re­la­tion­al solutions impress with high scal­a­bil­i­ty on the one hand and high re­li­a­bil­i­ty on the other. If the volume of data increases, these systems simply grow with it and still retain their clear structure.

MongoDB relies on col­lec­tions and documents

Before we look at MongoDB vs. Cassandra in detail and compare them, it is worth taking a look at the high­lights of MongoDB. The name of this system is derived from the English “huMONGOus” (meaning gigantic). The database was developed in 2009 by the company 10gen (now MongoDB, Inc.) and is still dis­trib­uted today under the pro­pri­etary Server Side Public License. It is written in C++ and stores data in col­lec­tions and documents. MongoDB, which is available in a free community version and a pro­pri­etary en­ter­prise version, is one of the most suc­cess­ful databases in the world.

Tip

A NoSQL database tailored to your needs. Choose Managed MongoDB from IONOS and benefit from maximum scal­a­bil­i­ty, com­pre­hen­sive data analysis and the optimal hardware for your workload. Find the right plan for your needs now!

Cassandra: The column-oriented solution

Even if MongoDB and Cassandra differ in many respects, at least their re­spec­tive first releases are close to each other. Cassandra was released in 2008, but was still developed ex­clu­sive­ly for Facebook at the time. In 2009, the Apache Software Foun­da­tion took over work on the cross-platform, column-oriented NoSQL database man­age­ment system, pro­grammed in Java.

In addition to the inventors Avinash Lakshman and Prashant Malik, companies such as DataStax, IBM and Twitter were also involved in the de­vel­op­ment of Cassandra. Today, the system is dis­trib­uted under the Apache license and is available in a free version as well as several paid versions. Cassandra is one of the most popular column-oriented databases in the world.

Purpose and scal­a­bil­i­ty

Both options are par­tic­u­lar­ly suitable for pro­cess­ing es­pe­cial­ly large data col­lec­tions and rely on the NoSQL approach. This means that both can also handle un­struc­tured data volumes, as they operate in­de­pen­dent­ly of tables and rely on different nodes instead. This in turn increases the scal­a­bil­i­ty of both solutions. Compared to their SQL com­peti­tors, the two systems are therefore ideal for companies that need to deal with large volumes of data from the outset, as well as for companies whose re­quire­ments are perhaps not yet fore­see­able at the beginning and will increase over time.

MongoDB is the best choice if you need to deal with mostly un­struc­tured data. Although both systems are suitable for this work, the flex­i­bil­i­ty of MongoDB ensures that this database is a little easier to scale. Cassandra also offers flex­i­bil­i­ty, but as its structure is at least similar to the SQL style, this system is somewhat easier to switch to NoSQL. Cassandra uses CQL, a query language that is similar to tra­di­tion­al databases. In a direct com­par­i­son of MongoDB vs. Cassandra, MongoDB lags behind in this area with a stand-alone query that must initially be learned.

Compute Engine
The ideal IaaS for your workload
  • Cost-effective vCPUs and powerful dedicated cores
  • Flex­i­bil­i­ty with no minimum contract
  • 24/7 expert support included

The ap­proach­es of MongoDB vs. Cassandra

Although MongoDB and Cassandra pursue similar goals, their re­spec­tive ap­proach­es are fun­da­men­tal­ly different. MongoDB stores its data in documents that are created in col­lec­tions. Each document is made up of key-value pairs. The keys are basically character strings. Values can be boolean values, data, other documents, numbers or strings. In contrast, Cassandra works column-oriented (in Sorted String Tables) and par­ti­tions based on rows. An SSTable like this cannot be changed sub­se­quent­ly. It contains a sorted set of the re­spec­tive key-value pairs. Although Cassandra is con­sid­ered a NoSQL database, its approach is “Not only SQL”. The Cassandra Query Language is much more flexible.

Data models

The fact that MongoDB nev­er­the­less offers somewhat greater flex­i­bil­i­ty is par­tic­u­lar­ly evident when comparing the data models of MongoDB and Cassandra. MongoDB does not require an actual schema and uses the JSON-like BSON format. An employee register could look like this, for example:

Employees: [
{
Employee_ID: "1",
Name: "Maria Johnson",
City: "Sacramento"
},
{
Employee_ID: "2"
Area: "IT"
Email: sbrown@example.com
}]
bson

In contrast, Cassandra relies on tables that can be clas­si­cal­ly divided into rows and columns. The data is saved as key-value pairs. The com­pa­ra­ble employee register would look something like this:

Employee_ID 1 Column - Name		Column - City
		Value - Maria Johnson	Value - Sacramento
Employee_ID 2 Column - Name		Column - Area		Column - Email
		Value – Simon Brown	Value - IT		Value - sbrown@example.com
text

Avail­abil­i­ty

The com­par­i­son of MongoDB vs. Cassandra also shows sim­i­lar­i­ties and dif­fer­ences in terms of the avail­abil­i­ty of their stored data. Both systems secure the data by dis­trib­ut­ing the load across different server nodes. MongoDB, however, relies on only one primary node, which is repli­cat­ed in order to be prepared for possible failures. All write op­er­a­tions are routed to this node and then passed on from there to its replicas. If the master node fails, another one takes over. In Cassandra, however, it is possible to set up several master nodes with the ap­pro­pri­ate in­fra­struc­ture. If one or more fail, the re­place­ment is always ready.

Com­pat­i­bil­i­ty and pro­gram­ming languages

Both Cassandra and MongoDB are com­pat­i­ble with several server operating systems. Both run on Linux, macOS and Windows. Cassandra also offers support for BSD and MongoDB for Solaris.

The following pro­gram­ming languages are supported by the two database man­age­ment solutions:

Pro­gram­ming language Supported by Mongo DB Supported by Cassandra
Ac­tion­script
C
C#
C++
Clojure
Cold­Fu­sion
D
Dart
Delphi
Erlang
Go
Groovy
Haskell
Java
JavaScript
Kotlin
Lisp
Lua
MatLab
Perl
PHP
Pow­er­Shell
Prolog
Python
R
Ruby
Scala
Smalltalk
Swift

Security

In the re­spec­tive basic version, the security of MongoDB and Cassandra is primarily in the hands of the users. In addition to SSL or TLS for client con­nec­tions and user au­then­ti­ca­tion, advanced measures such as a suitable firewall are required. Com­mer­cial solutions such as MongoDB Atlas, on the other hand, offer extensive security features such as X.509, en­cryp­tion on the client and server side as well as Kerberos and LDAP in­te­gra­tion.

Mobile use

There are no special versions of Cassandra that are designed for mobile use. Tools for (further) de­vel­op­ment on smart­phones are also not available. In com­par­i­son MongoDB vs. Cassandra, MongoDB has more options for mobile use. Realm is a database man­age­ment system from MongoDB that is specially designed for mobile operating systems. The paid version Atlas also offers solutions for mobile use.

Which companies use MongoDB or Cassandra?

Even though there are numerous dif­fer­ences in the MongoDB vs. Cassandra com­par­i­son, the lists of companies that rely on one of the two solutions are equally im­pres­sive. The best-known companies that use MongoDB include the following:

  • Adobe
  • Amadeus
  • AppScale
  • Craftbase
  • Disney
  • Etsy
  • Foursquare
  • Lyft
  • MTV
  • The New York Times
  • Via Varejo

The companies that use Cassandra are also extremely prominent. Although Facebook and Meta no longer rely on this database’s services, the following companies are on board:

  • Apple
  • Discord
  • Digg
  • Hulu
  • Intuit
  • Instagram
  • Netflix
  • Reddit
  • Spotify
  • X (formerly Twitter)
Tip

In our Digital Guide you will find many more articles on the topic of databases. For example, we compare MariaDB vs. MySQL, introduce you to the best open source databases and help you get started with MongoDB.

Go to Main Menu