Introduction to MongoDB
What is MongoDB?
MongoDB is a NoSQL database that stores data in a flexible, JSON-like format called BSON (Binary JSON). It is designed for high performance, high availability, and easy scalability.
Key Features:
- Document-Oriented: Stores data in documents (similar to JSON).
- Schema-Free: No fixed schema; documents in a collection can have different structures.
- Horizontal Scalability: Easily scales out by adding more servers.
Differences between SQL and NoSQL
- SQL Databases:
- Schema: Fixed schema with predefined tables and columns.
- Data Model: Table-based with rows and columns.
- Scalability: Typically scales vertically (upgrading hardware).
- NoSQL Databases:
- Schema: Flexible schema with dynamic data structures.
- Data Model: Document, key-value, column-family, or graph-based.
- Scalability: Generally scales horizontally (adding more servers).