Understanding MongoDB Architecture: Databases, Collections, and Documents
MongoDB is designed around a flexible architecture that includes databases, collections, and documents. This post will explain these core components and how they fit together.
MongoDB Architecture Overview
Databases:
- Definition: A database in MongoDB is a container for collections and is analogous to a schema in SQL databases.
- Example:
myDatabase
can contain multiple collections likeusers
,orders
, etc.
Collections:
- Definition: Collections are groups of documents and are similar to tables in relational databases.
- Example:
db.users
is a collection that holds user documents.
Documents:
- Definition: Documents are the basic units of data in MongoDB, stored in BSON format.
{ "name": "Alice", "age": 25, "email": "alice@example.com" }
MongoDB architecture, MongoDB databases, MongoDB collections, MongoDB documents, BSON format, MongoDB schema.