Introduction to MongoDB

Introduction to MongoDB

Introduction to MongoDB - Most popular NoSQL database

In this tutorial, we'll look at what MongoDB is and why you should bother learning it?

Let's start with why

Here are just a few reasons why I think it's worth our time to learn more about this exciting technology :

  • It's in demand and as far as I can tell it'll remain in demand for quite a while, so it's a safe bet.

  • If you've worked with JSON data, you'll be able to learn about MongoDB documents in no time.

  • MongoDB is very popular with NodeJS and ReactJS/Angular/Vue(ton of front-end frameworks/libraries) for building full-stack applications.

  • Horizontally Scalable .i.e adding more machines. This is in contrast to Vertical Scaling where we add more resources(CPU, RAM, etc) which is not always feasible.

  • Flexibility. In MongoDB, we don't need to have a strict and fixed schema from the start, we can always add new fields as our needs evolve.

  • Most of the data types in MongoDB map very easily to data types available in most languages.

I strongly believe in knowing why you're learning something before starting it.

Now that we know why, let's explore how.

How to learn MongoDB

Considering how this is going to be a tutorial series on MongoDB this section might seem a little strange. However, there's a good reason behind this short section.

No one article or video can teach you everything.

Below are some of my recommendations on how to truly learn and understand not just MongoDB but any technology in general :

  • Nothing in this world is perfect so there's no harm in trying different articles, books, and videos.

  • Always use official documentation if you want to dig deeper.

  • Don't expect to learn and understand everything overnight.

  • Be consistent.

What is MongoDB?

If you google "What is MongoDB?" you'll find many articles with good answers and they all will have some common words used like NoSQL database, document-oriented, open source, cross-platform, optional schema/schemaless, etc.

Let's have a look at those and understand what they mean

  • NoSQL Database and Optional schema / Schemaless means that, unlike SQL databases, we don't have to follow a specific schema/structure for documents that we're going to store.

  • Document-oriented means that we don't store data in terms of tables and rows. We store data in Binary JavaScript Object Notation(BSON) format. We will discuss all the supported data types in the coming articles.

/* Below is an example of a document stored in MongoDB collection */

{
  platform: "hashnode",
  name: "JayeshKarli",
  action: [
    "Read-Articles",
    "Follow"
  ]
}
  • Open-source simply means that the source code for MongoDB is publically accessible. If interested you can click here to explore the MongoDB GitHub repo.

  • MongoDB is cross-platform which allows us to use it on multiple platforms.

I hope this article helps you to get started with MongoDB. Drop a reaction if you like the article and if you don't tell me why in the comments, I love positive criticism.

Follow me for more such articles.

Did you find this article valuable?

Support Jayesh Karli by becoming a sponsor. Any amount is appreciated!