Skip to content

1. NoSQL databases

Version Data Notes
Version 1.0 January 2023 Initial version
Version 1.0 December 2024 Transaltion and minor changes

© Joan Gerard Camarena Estruch

These materials are based on previous years notes created by Joan Gerard Camarena and Jose Alfredo Murcia

The NoSQL movement (Not Only SQL) contemplates all those alternatives to traditional relational database management systems. Object-oriented databases, could be a first approach to these NoSQL databases. However, there are other models, with a totally different approach. These are databases based on documents, on key-value pairs or on graphs.

Although some of the characteristics posed by these paradigms are being incorporated into SQL standards and relational DBMS, the current reality is that this type of database is growing considerably in many areas. At the beginning of the 2000s, web 2.0 emerged, which meant the conversion of users into content generators. Subsequently, with web 3.0 or semantic web, the Internet becomes a large database, and access to it is no longer exclusive to web applications, but to all kinds of applications and apps. Currently, we are facing the rise of artificial intelligence and web 4.0, as an evolution of all the above. With all this, we can imagine the huge amount of data that servers must store, and that requires a more delocalized, distributed and sufficiently efficient storage to support millions of daily queries.

In this unit we are going to focus on document-type databases, specifically MongoDB, a database based on JSON documents, very popular on the web.

1.1. Database kind

We could find

  1. Key-Value Databases → It is a fairly simple and popular database model, where each element is identified by a unique key, following the Hash table model, so that the data is recovered very quickly. Objects are generally stored as binary objects (BLOBs). Some databases of this type are Cassandra (Apache), Bigtable (Google), or Dynamo (Amazon).

  2. Documentary databases → This model stores the information in the form of documents, generally XML or JSON, and a unique key is used for each record, so key-value searches are allowed. The difference with respect to previous key-value databases is that here the value is the document itself, not binary data. As we will see later, they are very versatile, so we don't even need to have a common structure for the documents we save. The maximum exponent of this type of database is MongoDB.

  3. Databases in Graphs → A graph is a set of vertices or nodes joined by edges, which allow us to represent relationships between them. Graph databases attempt to follow this model, so that the information is represented as nodes in a graph, and the relationships between them are represented by edges. In this way, taking advantage of graph theory, we can go through the information in an optimal way. Some examples of this type of database are Amazon Neptune, JanusGraph (Apache), SQL Server (Miscrosoft) or Neo4j.