Prev Next

Database / MongoDB Interview questions

Cassandra vs MongoDB - What are the Differences?

MongoDB Cassandra
Data AvailabilityMongoDB has a single master directing multiple slave nodes. If the master node goes down, one of the slave nodes takes over its role. Although the strategy of automatic failover does ensure recovery, it may take up to a minute for the slave to become the master. During this time, the database isn't able to respond to requests.Instead of having one master node, Cassandra utilizes multiple masters inside a cluster. With multiple masters present, there is no fear of any downtime. The redundant model ensures high availability at all times.
ScalabilityOnly the master node can write and accept input. In the meantime, the slave nodes are only used for reads. Accordingly, as MongoDB has a single master node, it is limited in terms of writing scalability.Having multiple master nodes increases Cassandras writing capabilities. It allows this database to coordinate numerous writes at the same time, all coming from its masters. Therefore, the more master nodes there are in a cluster, the better the write speed (scalability).
Data ModelMongoDB's data model is categorized as object and document-oriented. This means it can represent any kind of object structures which can have properties or even be nested for multiple levels.When it comes to Cassandra, there is a more traditional model. Cassandra has a table structure using rows and columns. Still, it is more flexible than relational databases since each row is not required to have the same columns. Upon creation, these columns are assigned one of the available Cassandra data types, ultimately relying more on data structure.
Query LanguageMongoDB uses queries structured into JSON fragments and does not have any query language support yet. Unlike MongoDB, Cassandra has its own query language called CQL (Cassandra Query Language). Its syntax is similar to SQL but still has some limitations.

It's right time to invest in Cryptocurrencies Dogecoin! Earn free bitcoins up to $250 now by signing up.

Earn bitcoins upto $250 (free), invest in other Cryptocurrencies when you signup with blockfi. Use the referral link: Signup now and earn!

Using BlockFi, don't just buy crypto - start earning on it. Open an interest account with up to 8.6% APY, trade currencies, or borrow money without selling your assets.

Join CoinBase! We'll both receive $10 in free Bitcoin when they buy or sell their first $100 on Coinbase! Available in India also. Use the referral Join coinbase!

Invest now!!! Get Free equity stock (US, UK only)!

Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.

The Robinhood app makes it easy to trade stocks, crypto and more.

Webull! Receive free stock by signing up using the link: Webull signup.

More Related questions...

Show more question and Answers...


Comments & Discussions