MongoDB

MongoDB vs Apache Cassandra

There are two main databases that will compete for your stack share when searching for a NoSQL database: Apache Cassandra and MongoDB.

Therefore, before committing to a specific database, it is good to compare the two databases. The goal of this post is to outline the various features of each database which will allow you to correctly evaluate what database to use and why.

What is MongoDB?

MongoDB is one of the most popular, cross-platform document-oriented database. It is a NoSQL database that stores the data in the form of optimized JSON objects or Binary JSON.

The documents in a MongoDB database are then stored in logical groups known as collections. You can have a document containing key-value pairs of various types such as strings, number, nested objects, arrays, dates, etc.

MongoDB is highly flexible with a minimal learning curve allowing new users to quickly adopt into small to large scale applications.

What is Cassandra?

Cassandra is a free, open-source, and distributed wide-column datastore. Cassandra stores data in table-like format which is closely similar to relational database. However, Cassandra is not a relational database as it removes support for feature programs such as strict schema definition, joins, and subqueries.

Cassandra is highly flexible and supporting additional feature such as metadata, JSON support, etc.

Cassandra is developed to be a high-tolerance datastore that allows data to replicated in various nodes. This means that it provides exceptional levels of reliability and removes the single point of failure.

There are various variations of the Cassandra database. However, in the context of this post, Cassandra refers to the open-source Apache Cassandra version of the database.

Feature MongoDB Apache Cassandra
Developer MongoDB Inc, 2009 Apache Software Foundation, 2008
Language C++, Go, JavaScript, and Python Java
Data Model Document-oriented as JSON objects Wide-column tabular store
Indexing Primary and secondary index support Supports primary and secondary indexing on the cursor allowing for basic filters
Transactions Full ACID transaction compliance No ACID transactions support
Query Language MongoDB Query Language Cassandra Query Language
Write Scalability Limited Full write scalability support
Operating System Support Windows, OS X, Linux, Solaris Linux, Unix
Scalability Vertical/Horizontal Vertical/Horizontal
Security SCRAM and certificates,

TLS/SLL

Server-Side Engine encryption

LDAP and Kerberos auth

TLS/SSL

User Authentication

Conclusion

It is good to keep in mind that the above listed features do not accurately capture what each database is capable of. It is therefore a good measure to perform you internal testing based on your application requirements and features.

About the author

John Otieno

My name is John and am a fellow geek like you. I am passionate about all things computers from Hardware, Operating systems to Programming. My dream is to share my knowledge with the world and help out fellow geeks. Follow my content by subscribing to LinuxHint mailing list