IT Book 2

Introduction to MongoDB

MongoDB is a NoSQL database that stores data in JSON-like documents instead of tables. It is highly scalable, flexible, and schema-less, making it ideal for modern web and mobile applications.

MongoDB Architecture

MongoDB follows a client-server architecture with the following components:
✅MongoDB Server → Manages the database.
✅Database → A collection of related data.
✅Collections → Groups of documents (similar to tables).
✅Documents → JSON-like objects storing data.
✅Fields → Key-value pairs inside a document.

Installation and Setup

To install MongoDB on Windows / macOS / Linux:
✅ Download MongoDB from the official website.
✅Install and start MongoDB Server (mongod command).
✅Connect using MongoDB shell (mongosh).

Basic MongoDB Commands

✅Checking MongoDB Version
✅Starting the MongoDB Shell
✅Show all Databases
✅Create or Switch to a Database
. ✅Show Collections (Tables in SQL)

CRUD Operations (Create, Read, Update, Delete)

✅Create (Insert Data into MongoDB)
✅Read (Find Data in MongoDB)
✅Update (Modify Existing Documents)
✅Delete (Remove Documents)

Indexing in MongoDB

Indexes improve query performance by reducing scan time.

Aggregation Framework in MongoDB

The aggregation framework helps process and analyze large datasets.

Relationships in MongoDB

MongoDB supports two types of relationships:
✅Embedded Documents (Denormalization) → Stores related data inside a single document.
✅Referencing (Normalization) → Links documents using an _id field.

MongoDB Atlas (Cloud Database)

MongoDB Atlas is a fully managed cloud database.
✅Steps to Use MongoDB Atlas:
✅Sign up for MongoDB Atlas.
✅Create a new cluster.
✅Connect to the cluster using MongoDB Compass or a programming language.

Conclusion

MongoDB is a powerful NoSQL database that provides flexibility, scalability, and high performance for modern applications. It is widely used in e-commerce, IoT, social media, and big data applications.

End of Flip Book

Your AI Assistant