NoSQL and Mongo DB introduction

NoSQL – What it is?

NoSQL is a common term used for database technologies that veer from the traditional databases (RDBMS – Relational Database Management System) concepts. NoSQL databases try to achieve a better standard of availability and partitioning capabilities than the RDBMS databases.

An ideal database system should be good at consistency, availability, and partition tolerance. Traditional RDBMS databases are good at consistency. The NoSQL databases are good at data availability and partitioning.

NoSQL databases can be classified in three main categories: document stores, key-value stores, and graph-based stores. MongoDB is part of the document store category. Other popular NoSQL databases are: Cassandra, Redis, Hbase etc.

MongoDB introduction

MongoDB is a NoSQL document store database. MongoDB is open source and its source is available online.

MongoDB is a JSON-friendly database.
Documents are stored and retrieved from the database as JavaScript objects. That means, the same data format is used on the client, server, and database.

A typical entry in a MongoDB database might look like the following code:


{
    "_id": {
        "$oid": "593f0b8e27d4a014b6126edb"
    },
    "password": "$2a$10$C85rtirELzGRXhlVxKjufOv6TqVxY0J9ymQgr3vCVaKS4AMskWSSG",
    "email": "info@saigon.ro",
    "history": [],
    "profile": {
        "picture": "https://gravatar.com/avatar/00e4e412992e0e25f6a066a9ebe8996d?s=200&d=retro",
        "name": "John"
    },
    "__v": 0,
    "address": "Vietnam, HCMC"
}

MongoDB is schemaless.
A relational database require you to define from the very beginning the exact structure of data being stored, which is called schema. Number of columns, length, and data types must perfectly match in every field.

Documents stored in a MongoDB database don’t have to follow any schema.

MongoDB is designed with highly concurrent applications with heavy read operations in mind.
A MongoDB database can be scaled horizontally as well as vertically.

However, MongoDB is not very good at consistency since it doesn’t adhere to the RDBMS standards. In some cases, a traditional RDBMS database might be more suitable for you and the application you want to developed.

Leave a Reply