Introduction to MongoDB and NoSQL — Day 1



This content originally appeared on DEV Community and was authored by Shifa

Lets not waste our time on intro directly dive deep into the concept

What is MongoDB?

MongoDB is a NoSQL database that stores data in a flexible, JSON-like format called documents. Unlike traditional databases that require structured tables and fixed columns, MongoDB allows you to store varied data structures within the same collection.

MongoDB is often used in the backend of applications to manage and store data, but it’s important to note that MongoDB itself is not a backend framework — it is strictly a database.

What Does “NoSQL” Mean?

Many people think “NoSQL” means “no SQL,” but that’s not entirely accurate.

NoSQL actually stands for “Not Only SQL”, and it refers to a class of databases that break away from traditional relational models.

Instead of storing data in rows and columns (like in MySQL or PostgreSQL), NoSQL databases store data in formats like:

  • Key-value pairs
  • Wide-column stores
  • Graph databases
  • Document-oriented databases (like MongoDB)

SQLvsNOsql

SQL vs NoSQL — What’s the Difference?

Here’s a quick comparison to help you understand how MongoDB differs from traditional SQL databases:

Feature SQL (Relational DB) NoSQL (MongoDB)
Data Structure Tables (Rows & Columns) Documents (JSON-like)
Schema Fixed Flexible (Schema-less)
Relationships Joins, Foreign Keys Embedding or Referencing
Scalability Vertical (scale-up) Horizontal (scale-out)
Best For Structured data Dynamic, unstructured data
Examples MySQL, PostgreSQL MongoDB, CouchDB, Cassandra

MongoDB Structure: Key Terminology

Let’s break down the three most important terms you’ll encounter in MongoDB:

  • Document: A single data record stored in JSON or BSON format. Example:
  { "name": "Shifa", "roll no": 21, "email": "shifa@example.com" }
  • Collection: A group of related documents, similar to a table in SQL.

  • Database: A container for collections — the top-level structure in MongoDB.

Why MongoDB is Flexible

In SQL, all records in a table must follow the same schema — same columns, same types. In MongoDB, this restriction doesn’t exist.

You can store documents with different structures in the same collection.

For example:

{ "name": "sahil", "age": 25 }
{ "name": "sam", "email": "sam@example.com" }

These two documents live in the same collection, but they have different fields — and that’s completely valid in MongoDB.

What You’ll Do Today

As part of Day 1, here’s what students should do to get hands-on experience:

1. Install MongoDB

2. Explore MongoDB Compass

  • MongoDB Compass is a GUI that helps you view databases and documents.
  • Use it to create a new database and insert your first document.

3. Insert a Document

Example:

{
  "name": "Shifa",
  "roll no": 21,
  "course": "MongoDB Basics"
}

Congratulations — you’ve just added your first record to a NoSQL database!

References –
https://www.mongodb.com/resources/basics/unstructured-data/schemaless
https://www.integrate.io/blog/the-sql-vs-nosql-difference/
https://www.mongodb.com/resources/basics/databases/nosql-explained


This content originally appeared on DEV Community and was authored by Shifa