This text is a practical guide to performing basic operations in MongoDB, one of the most popular NoSQL databases for storing and managing data. It focuses on essential topics like CRUD operations (Create, Read, Update, Delete), customizing queries with sorting, pagination, and projections, and more advanced techniques such as the Aggregation Framework.

In addition to these, this guide touches on:

Using query operators for filtering data (e.g., $eq, $gt, $in), working with nested fields, utilizing logical operators ($and, $or, $not), managing arrays with operators like $push and $unwind, and even performing joins between collections with $lookup. Whether you’re a beginner looking to get started or an experienced user aiming to brush up on key concepts, this guide provides a clear and concise overview of MongoDB's most practical and widely used features.


1. CRUD Operations (Create, Read, Update, Delete)

1.1 Create - Inserting Data


1.2 Read - Querying Data

Query Operators


1.3 Update - Updating Data

Update Operators


1.4 Delete - Deleting Data


2. Customizing Queries

2.1 Field Projection


2.2 Sorting and Pagination


2.3 Regular Expressions


2.4 Querying Nested Fields


2.5 Logical Operators


3. Aggregation Framework

3.1 Aggregation Pipeline


3.2 Key Stages

3.2.1 $match (Filtering Data)


3.2.2 $project (Data Transformation)


3.2.3 $group (Data Grouping)


3.2.4 Sorting and Limiting


3.2.5 Array Manipulation


3.2.6 $lookup (Relationships)


3.2.7 $out (Export Results)