MongoDB is a document-oriented NoSQL database that stores data as flexible, JSON-like documents (stored internally as BSON) grouped into collections instead of tables.
Why it matters
MongoDB lets each document have its own shape, which suits content, catalogs, and rapidly changing data models. It supports secondary indexes, aggregation pipelines, replica sets for high availability, and sharding for scale. Documents in a collection are not forced to share fields, which makes early development quick but pushes validation to you. Modern versions also provide multi-document transactions, though designs that keep related data inside one document remain the most efficient.
Example
db.products.insertOne({ sku: "A-100", title: "Mug", tags: ["kitchen"], price: 9.5 })
db.products.find({ tags: "kitchen", price: { $lt: 20 } })
The default port is 27017.
Common mistakes
- Exposing MongoDB without authentication to the internet, a long-running source of data leaks.
- Letting documents grow without bound, since there is a per-document size limit.
- Skipping indexes because the database is "schemaless", then scanning whole collections.
Related
Get notified when this term updates
Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.
This page is general information written by our editorial team and updated when documentation changes. Servers and providers differ, so test changes safely first. See our editorial policy and disclaimer.