Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pros and cons of MongoDB? [closed]

Could anybody tell me what is the pros and cons of mongodb, especially comparing with the relational database? including ACID, scalability, throughput, main memory usage, insert/query performance and index size etc.

like image 821
zbdiablo Avatar asked Mar 09 '11 10:03

zbdiablo


People also ask

What are the disadvantages of MongoDB?

Cons: Data size in MongoDB is typically higher due to e.g. each document has field names stored it. less flexibity with querying (e.g. no JOINs) no support for transactions - certain atomic operations are supported, at a single document level.

When MongoDB should not be used?

MongoDB would not be well suited for applications that need: Multi-Object Transactions: MongoDB only supports ACID transactions for a single document. SQL: SQL is well-known and a lot of people know how to write very complex queries to do lots of things.

Is storage efficiency drawback of MongoDB?

Disadvantages of MongoDB There are a few disadvantages of the MongoDB NoSQL database as well. MongoDB uses high memory for data storage. There is a limit for document size, i.e. 16mb. There is no transaction support in MongoDB.

Can MongoDB lose data?

Even though it's true that MongoDB can lose data if you use the default settings, the failovers aren't that frequent to make a significant difference. However, if your business requires safety to be the topmost priority, MongoDB provides you with configurable durability levels to suit your needs.


1 Answers

Some general points on MongoDB

Pros:

  • schema-less. If you have a flexible schema, this is ideal for a document store like MongoDB. This is difficult to implement in a performant manner in RDBMS
  • ease of scale-out. Scale reads by using replica sets. Scale writes by using sharding (auto balancing). Just fire up another machine and away you go. Adding more machines = adding more RAM over which to distribute your working set.
  • cost. Depends on which RDBMS of course, but MongoDB is free and can run on Linux, ideal for running on cheaper commodity kit.
  • you can choose what level of consistency you want depending on the value of the data (e.g. faster performance = fire and forget inserts to MongoDB, slower performance = wait til insert has been replicated to multiple nodes before returning)

Cons:

  • Data size in MongoDB is typically higher due to e.g. each document has field names stored it
  • less flexibity with querying (e.g. no JOINs)
  • no support for transactions - certain atomic operations are supported, at a single document level
  • at the moment Map/Reduce (e.g. to do aggregations/data analysis) is OK, but not blisteringly fast. So if that's required, something like Hadoop may need to be added into the mix
  • less up to date information available/fast evolving product

I recently blogged my thoughts on MongoDB as someone coming from SQL Server background, so you might be interested in that (above are just some of the main points).

If you're looking for a "Is MongoDB better than RDBMS" answer - then IMHO there is no answer. NoSQL technologies like MongoDB provide an alternative, that complements RDBMS technologies. One may be better suited to a particular purpose than the other, so it's all about making a call on what is best for you for a given requirement.

like image 174
AdaTheDev Avatar answered Sep 17 '22 23:09

AdaTheDev