All Articles

NoSQL - Firestore Saved My Life

TL;DR

NoSQL saves time if you have to deal with a data that has to be updated and read often


So far, I never had to use NoSQL for my projects. My projects don’t require me to read or write a lot of information from/to databases, so MySQL — which is an RDBMS that I am most familiar with — has been sufficient.

But for one of my projects, I had to check whether a specific set of users was active. And in order to implement that, I decided to use Firebase Firestore

Firestore is a NoSQL document database.

And one of the nice things about using Firestorewas that I could change akey of my json data without changing the table. For instance, I first created a table with a key called status and I used strings such as online and offline as its value. But I wanted to change the data type to boolean in order to avoid using === the operator in JavaScript.

In order for me to do that using MySQL, I would have to ALTER TABLE . However, with NoSQL, I didn’t have to do that. I just changed the key-value without changing a database setting, and it worked perfectly fine without throwing any error. And I got my job done

so I decided to look into NoSQL and see what it is.


There are three different types of NoSQL. Document, Key-Value, and Graph

  1. Document

    • The most popular Document NoSQL database is MongoDB.
    • Just like the name says, it allows you to save your data as JSON Document
    • You can store your JSON data however you want in whatever format you desire
  2. Key-Value

    • Cassandra and DynamoDB are popular
    • the key serves as a unique identifier
    • values can be anything starting from a string to complex objects

key-value NoSQL

  1. Graph

    • neo4j is popular
    • Graph is when values in a key-value database are interconnected.
    • Graph allows you to get data if the values are connected — or related.

another key-value graph

The difference between the three is very well explained in the neo4j document.

May 30, 2022

AI Enthusiast and a Software Engineer