Store and query documents while choosing suitable indexes and data models.

Before starting: JSON documents, keys, arrays, and basic query concepts.

Practice project: Build a study-log collection with validation and suitable indexes.

Module 1: NoSQL Foundations & MongoDB Architecture

  1. Introduction to NoSQL & MongoDB Document Database Architecture
  2. BSON Data Types, ObjectId Internal Structure & JSON Mapping
  3. Installation, Mongosh Shell & Compass GUI Orchestration
  4. Creating Databases, Collections & Document Namespaces (`use`, `createCollection`)
  5. Capped Collections & TTL (Time-To-Live) Automated Expiration

Module 2: CRUD Operations - Insert & Read Mastery

  1. Inserting Single & Bulk Documents (`insertOne`, `insertMany`)
  2. Querying Documents with Equality & Comparison Operators (`$eq`, `$gt`, `$in`, `$nin`)
  3. Logical Query Operators (`$and`, `$or`, `$not`, `$nor`) & Implicit Conjunctions
  4. Element & Type Evaluation Operators (`$exists`, `$type`)
  5. Projection, Cursor Paging, Sorting & Limiting (`find`, `sort`, `skip`, `limit`)

Module 3: CRUD Operations - Update & Delete Mastery

  1. Updating Documents with Atomic Modifiers ($set, $unset, $inc, $mul)
  2. Advanced Field Updates ($min, $max, $currentDate, $rename)
  3. Upsert & Conditional Modifications (updateOne with upsert: true)
  4. Deleting Documents & Drop Operations (deleteOne, deleteMany, drop)
  5. Bulk Write Pipelines (bulkWrite ordered vs unordered)

Module 4: Arrays & Embedded Documents

  1. Querying Embedded Sub-documents & Dot Notation
  2. Querying Array Elements ($all, $elemMatch, $size)
  3. Array Updates: Adding Elements ($push, $each, $slice, $sort, $addToSet)
  4. Array Updates: Removing Elements ($pop, $pull, $pullAll)
  5. Positional Array Modifiers ($, $[], $[<identifier>] filtered positional operator)

Module 5: Aggregation Pipeline Foundations

  1. Aggregation Pipeline Architecture & Flow
  2. Filtering & Reshaping ($match, $project)
  3. Grouping & Accumulators ($group, $sum, $avg, $min, $max)
  4. Deconstructing Arrays with $unwind
  5. Sorting, Pagination & Sampling ($sort, $skip, $limit, $sample)

Module 6: Advanced Aggregation & Joins

  1. Relational Joins with $lookup (Uncorrelated & Correlated Subqueries)
  2. Aggregation Output Pipelines ($out, $merge)
  3. Conditional Expressions ($cond, $switch, $ifNull)
  4. String, Date & Mathematical Aggregation Operators
  5. Modern Window Functions ($setWindowFields)

Module 7: Indexing Strategies & ESR Rule

  1. Index Architecture & Single-Field Indexes (createIndex, dropIndex)
  2. Compound Indexes & the ESR (Equality, Sort, Range) Rule
  3. Multikey Indexes & Partial/Sparse Indexes
  4. Text Search Indexes & Language Analyzers ($text, $search, weights)
  5. Geospatial Indexes (2dsphere, 2d, $near, $geoWithin)

Module 8: Performance Tuning & Schema Validation

  1. Execution Plans with explain('executionStats') (IXSCAN vs COLLSCAN)
  2. Covered Queries & Scanning Ratios (totalDocsExamined vs nReturned)
  3. Database Profiler & Slow Query Log Analysis
  4. Schema Validation with $jsonSchema (Enforcing Data Quality)
  5. Connection Pooling, Cursor Leaks & Driver Tuning

Module 9: High Availability & Sharding

  1. Replica Set Architecture & Heartbeats (Primary, Secondary, Arbiter)
  2. Automatic Failover, Elections & Quorum Mechanics
  3. Read Preferences & Write Concerns (w: majority, j: true, readConcern)
  4. Horizontal Sharding Architecture (mongos, Config Servers, Shard Keys)
  5. Resharding & Chunk Balancing Mechanics

Module 10: Security, Transactions & Atlas Cloud

  1. Multi-Document ACID Transactions (Client Sessions, commit, abort)
  2. Authentication & Role-Based Access Control (SCRAM, X.509, RBAC)
  3. Security, Encryption & Auditing (TLS, At-Rest, CSFLE)
  4. Node.js & Mongoose ODM Deep Dive (Schemas, Models, Middleware)
  5. MongoDB Atlas Cloud & Production Deployment Checklist

Test database constraints before adding application code

Test both accepted and rejected writes. In a relational database, a primary key prevents duplicate identifiers and a NOT NULL constraint prevents missing required values. Application validation improves feedback but does not replace database constraints. MongoDB uses different mechanisms, including unique indexes and collection validators; do not copy SQL statements into its shell.

SQLite 3 example; concept also applies to other databases using their own syntax

CREATE TABLE lessons (
  id INTEGER PRIMARY KEY,
  title TEXT NOT NULL
);
INSERT INTO lessons (id, title) VALUES (1, 'Loops');
SELECT id, title FROM lessons;
Check the output
id | title
1 | Loops

Write a checklist for valid insert, duplicate key, missing required field, and update. Translate the checks into your database dialect.

Open the MongoDB learning path on DevStudyHub · Play coding games on this blog

logoblog

No comments:

Post a Comment

Please do not enter any spam link in the comment box.