MongoDB Introduction

Introduction to MongoDB

MongoDB is a popular NoSQL database that stores data in a flexible, JSON-like format. It is designed for scalability, high availability, and fast performance.

Why Use MongoDB?

  • Schema-less document-based storage
  • High scalability and performance
  • Supports replication and sharding
  • Ideal for big data and real-time applications

Installation

To install MongoDB, use the following command:

sudo apt install -y mongodb

Basic MongoDB Commands

Start the MongoDB server:

sudo systemctl start mongodb

Check if MongoDB is running:

mongo --eval 'db.runCommand({ connectionStatus: 1 })'