PostgreSQL ER diagram

MongoDB vs PostgreSQL

Making a comparison of document-based database systems like MongoDB and traditional relational databases like PostgreSQL is not a simple task. In fact, it is impossible to recommend one database platform, because everything depends on your requirements and the goals you wish to achieve. For some use cases, MongoDB can be the preferred solution, for many other use cases PostgreSQL can be the better option.
So how to compare MongoDB vs PostgreSQL?

Let’s see how both the databases are supported in Moon Modeler – data modeling tool for databases.

Collections and documents in MongoDB projects

One of the key benefits of MongoDB is the possibility to store documents in MongoDB collections easily. The data can be stored in hierarchical structure. In Moon Modeler the nested structures can be visualized this way:

MongoDB vs PostgreSQL - MongoDB diagram

Tables and columns with nested JSON structures in PostgreSQL projects

Many relational database platforms allow you to work with nested structures comfortably as well and PostgreSQL is not an exception. You can store your data in table columns that have a JSON data type and leverage PostgreSQL built-in functions for working with JSON. In many traditional data modeling tools, for a long period of time, it was not possible to visualize the nested structures, because a good database design was usually based on database normalization rules.

In Moon Modeler, JSON can be displayed inside tables. See the following screenshot:

MongoDB vs PostgreSQL - PostgreSQL diagram

Both the images look quite similar, right? So, if the structure can be very similar, what are the other key factors that may affect your database system selection. Is there something else to compare? Of course, a lot of things and you will certainly need to make additional research.

Fore more information about Moon Modeler, see key features for MongoDB schema design and PostgreSQL database modeling.

Other MongoDB vs. PostgreSQL comparison articles

Some valuable information, or at least one good tip related to overall MongoDB vs PostgreSQL comparison, can be found in the Comparison of MongoDB vs. PostgreSQL article published at