MongoDB

Module 1: Introduction to MongoDB

What is MongoDB?

MongoDB is a source-available cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with optional schemas. MongoDB is developed by MongoDB Inc.

Why MongoDB?

MongoDB is a database that provides high performance, high availability, and easy scalability. It works on the concept of collections and documents, as opposed to traditional relational databases which uses tables for storing data.

MongoDB Installation

Installation process can differ depending on the operating system you are using. MongoDB provides excellent documentation to help you through the process. Be sure to follow the official MongoDB installation guide for the most up-to-date instructions.

Module 2: Basic Concepts in MongoDB

Databases and Collections

A MongoDB instance can contain multiple databases, and a single database can contain multiple collections. A collection is a grouping of MongoDB documents, and is the equivalent of an RDBMS table.

Documents

A document is a set of key-value pairs, and is the basic unit of data in MongoDB. Documents within a collection can have different fields, and MongoDB uses a BSON format, which is a binary representation of JSON-like documents.

CRUD Operations

The four basic functions of persistent storage: Create, Read, Update, and Delete (CRUD) operations are used in MongoDB to manipulate the data.

Module 3: Querying Data

Basic Queries

Queries in MongoDB are used to fetch data from a database. Data can be fetched based on zero or more conditions. If a query does not include conditions, then it fetches data from a collection based on the query.

Advanced Queries

MongoDB provides a rich query language and several options for read operations. In addition to the basic queries, you can use operators like comparison, logical, array and others to write complex queries.

Indexes

Indexes are used in MongoDB for high performance read operations. An index is a data structure that holds the data of a few fields of documents on which the index is created.

Module 4: Advanced MongoDB Concepts

Aggregation

Aggregation operations process data records and return computed results. They perform a variety of operations on the grouped data to return a single result. MongoDB provides three ways to perform aggregation: aggregation pipeline, map-reduce function, and single purpose aggregation methods.

Replication

Replication is the process of synchronizing data across multiple servers. It provides redundancy and increases data availability with multiple copies of data on different database servers.

Sharding

Sharding is a method for distributing data across multiple machines. MongoDB uses sharding to support deployments with very large data sets and high throughput operations.