Introduction to NoSQL & MongoDB
MongoDB is a source-available, document-oriented database classified as a NoSQL database. It replaces the traditional relational table-based structure with flexible, JSON-like documents (BSON) containing dynamic schemas.
1 Relational vs Document Databases
- Tables vs Collections: In SQL databases, data is stored in tables. In MongoDB, data is stored in Collections of Documents.
- Rows vs Documents: SQL rows are replaced by BSON documents.
- Schema Flexibility: MongoDB documents inside a single collection can contain varying fields or datatypes.
- No Complex Joins: Data is structured hierarchically using nested documents and arrays, eliminating the performance overhead of relational SQL joins.
2 Code Challenge
Challenge: Write a brief summary explaining how MongoDB handles database schemas compared to traditional relational systems.