MongoDB

MongoDB

Introduction

MongoDB is a popular open-source, document-oriented NoSQL database. Instead of storing data in tables like traditional relational databases, MongoDB stores structured data in JSON-like documents.

Key Features

  • Document-oriented - stores data in flexible, JSON-like documents instead of rows and columns
  • Scalability - easy to scale horizontally with automatic sharding
  • High performance - performs well with large datasets and heavy workloads
  • High availability - supports replication and failover for high availability
  • Flexible data model - dynamic schemas allow you to store different data in the same collection
  • Indexing - indexes support faster queries and can include keys from embedded documents and arrays

Components

The main components of MongoDB are:

  • mongod - The MongoDB daemon that does the core data storage
  • mongos - The query router that provides sharding
  • Documents - Data records composed of field-value pairs
  • Collections - Groupings of MongoDB documents
  • Databases - Container for collections

Basic Concepts

  • JSON-like documents contain field-value pairs
  • Collections contain sets of documents
  • Databases contain collections
  • Uses BSON format to store documents (binary JSON)