MongoDB is a popular NoSQL database management system. It is especially useful for web applications that require scalability, speed and flexibility.
Table of contents
When using databases, we need to decide from which database management system we will choose. On the market we have a couple of options to choose from one of them is mongoDB, which I will briefly introduce in this article.
What is MongoDB?
MongoDB is an open source system for managing non-relational databases. It was written in C++ by a company called 10gen, with the first release in February 2009. It is characterized by the lack of a strictly defined structure of supported databases. The stored data is saved in files with JSON format. Instead of using tables and rows as for example MySQL does, MongoDB uses collections and documents. Documents consist of key-value pairs, which are the basic units of data. Collections contain sets of documents and functions, which are the equivalent of relational databases' tables.
Capabilities of MongoDB
MongoDB is easy to use and has high scalability. Because MongoDB is a noSQL database, so the data is stored in a document instead of a table. This makes MongoDB very flexible and adaptable to the actual situation. A big plus of MongoDB is that we can split the data across several servers. It uses the concept of sharding for horizontal scaling, dividing data between multiple MongoDB instances. This solves problems with overloaded servers, and we are able to duplicate data to keep the system running in case of failure. Another advantage of MongoDB is the concept of replication, it ensures high availability and protects against server failures. A replica set consists of two or more MongoDB instances. Each element of the replica set can act as a primary or secondary replica at any time. The primary replica interacts with the client and performs read and write operations. Secondary replicas store a copy of the databases. When the Primary Replica fails, the replica will automatically switch to the secondary one and it will become the primary server.