MongoDB
MongoDB is a document database that stores data as flexible JSON-like documents.
What Is MongoDB
MongoDB stores records as documents inside collections.
It is useful when data shape changes often, when nested data is natural, or when teams want flexible schemas during development.
How To Use MongoDB
Install MongoDB locally or use a hosted service. Create collections and insert documents.
Applications usually connect through an official driver or an ODM such as Mongoose.
Basic Example
db.users.insertOne({
name: "Tiew",
skills: ["docs", "web", "ai"],
});
db.users.find({name: "Tiew"});
Common Concepts
- Documents store nested data.
- Collections group related documents.
- Indexes improve query performance.
- Aggregation pipelines transform and analyze data.
What To Learn Next
Learn schema design, indexes, aggregation, validation, transactions, and when document databases fit better than relational databases.