mongodbrelational-databasedocument-oriented-dbdatabase

Are document-oriented databases meant to replace relational databases?


Recently I've been working a little with MongoDB and I have to say I really like it. However it is a completely different type of database then I am used. I've noticed that it is most definitely better for certain types of data, however for heavily normalized databases it might not be the best choice.

It appears to me however that it can completely take the place of just about any relational database you may have and in most cases perform better, which is mind boggling. This leads me to ask a few questions:

  1. Are document-oriented databases being developed to be the next generation of databases and basically replace relational databases completely?
  2. Is it possible that projects would be better off using both a document-oriented database and a relational database side by side for various data which is better suited for one or the other?
  3. If document-oriented databases are not meant to replace relational databases, then does anyone have an example of a database structure which would absolutely be better off in a relational database (or vice-versa)?

Solution

  • Are document-oriented databases have been developed to be the next generation of databases and basically replace relational databases completely?

    No. Document-oriented databases (like MongoDB) are very good at the type of tasks that we typically see in modern web sites (fast look-ups of individual items or small sets of items).

    But they make some big trade-offs with relational systems. Without things like ACID compliance they're not going to be able to replace certain RDBMS. And if you look at systems like MongoDB, the lack of ACID compliance is a big reason it's so fast.

    Is it possible that projects would be better off using both a document-oriented database and a relational database side by side for various data which is better suited for one or the other?

    Yes. In fact, I'm running a very large production web-site that uses both. The system was started in MySQL, but we've migrated part of it over to MongoDB, b/c we need a Key-Value store and MySQL just isn't very good at finding one item in a 150M records.

    If document-oriented databases are not meant to replace relational databases, then does anyone have an example of a database structure which would absolutely be better off in a relational database (or vice-versa)?

    Document-oriented databases are great storing data that is easily contained in "key-value" and simple, linear "parent-child" relationships. Simple examples here are things like Blogs and Wikis.

    However, relational databases still have a strong leg up on things like reporting, which tends to be "set-based".

    Honestly, I can see a world where most data is "handled" by Document-oriented database, but where the reporting is done in a relational database that is updated by Map-reduce jobs.