MongoDB
A document database that stores JSON-like records with a flexible schema, from one replica set to a sharded cluster.
- What it is
- Document databases
- Type
- Commercial product
- Made by
- MongoDB, Inc.
- License
- SSPL v1 (Community Server)
- Facts checked
- 5 October 2026
What it is
MongoDB stores documents (nested JSON-like objects, encoded as BSON) in collections, and documents in one collection don’t need the same fields. Instead of joining tables, you usually embed related data, such as an order’s line items, inside one document, and a write to a single document is always atomic. You query with filters on any field, secondary indexes, and the aggregation pipeline, a chain of stages such as $match, $group and $lookup.
Production deployments are replica sets: one primary takes every write and records it in an operation log (the oplog), and secondaries copy it. If the primary fails, the members elect a new one; with default settings the median election should take no more than 12 seconds. To grow beyond one machine, sharding splits a collection across replica sets by a shard key. Multi-document transactions exist (since 4.0 on replica sets and 4.2 on sharded clusters), but MongoDB’s own guidance is to model data so you rarely need them. The Community Server has been licensed under the SSPL since October 2018, which the Open Source Initiative does not approve.
Why teams pick it
- Flexible documents map directly onto application objects and change shape without migrations
- Rich queries, secondary indexes and an aggregation pipeline on any field
- Automatic failover through replica-set elections
- Sharding scales a collection out across many replica sets
Watch out for
- A document can be at most 16 MB, and nesting is limited to 100 levels
- Multi-document transactions cost more than single-document writes and time out after 60 seconds by default
- Secondaries replicate asynchronously, so reads from them can be stale
- The SSPL isn’t an OSI-approved open-source licence, which some companies’ policies rule out
How it fits with other technologies
What uses MongoDB
- Prisma ORMgenerates typed queries forMongoDB
- Zenko CloudServercan keep its metadata inMongoDB
- WAL-Gbacks up (beta)MongoDB
- Percona Operatorsdeploy Percona’s builds ofMongoDB
- JSONis stored as binary BSON documents inMongoDB
- Project Nessiecan keep its commit history inMongoDB
- Apache Calcitequeries, through an adapter,MongoDB
- Spice.ai OSSreplicates collections, via CDC, fromMongoDB
- Dremiofederates queries toMongoDB
- Artiereads change streams fromMongoDB
- OLakereads change streams fromMongoDB
- ClickStackkeeps dashboards, users and alerts inMongoDB
Insert an order with embedded items, then total revenue per SKU · python
from datetime import datetime, timezone
from pymongo import MongoClient, ASCENDING, DESCENDING
orders = MongoClient("mongodb://db1,db2,db3/?replicaSet=rs0").shop.orders
orders.create_index([("customer_id", ASCENDING), ("created_at", DESCENDING)])
orders.insert_one({"customer_id": 1042, "status": "paid", "created_at": datetime.now(timezone.utc),
"items": [{"sku": "A-17", "qty": 2, "price": 19.95}]})
revenue = orders.aggregate([
{"$match": {"status": "paid"}},
{"$unwind": "$items"},
{"$group": {"_id": "$items.sku", "revenue": {"$sum": {"$multiply": ["$items.qty", "$items.price"]}}}},
{"$sort": {"revenue": -1}},
])See it in a real stack
No architecture uses MongoDB yet. Drop it into the playground and wire it up yourself.Open playground →Benchmarks
Where it came from2007–2025
Dwight Merriman, Eliot Horowitz and Kevin Ryan had worked together at DoubleClick, the ad company Google later bought, where scaling to more than 400,000 ads per second taught them the limits of relational databases. In 2007 they founded 10gen to build an open-source cloud computing stack, and started writing a document database as its data layer.
The first official release, 0.8, came in February 2009. When the founders saw the database’s potential, they turned the whole company toward it. The name is short for “humongous database”. It caught on quickly with developers, and in August 2013 10gen renamed itself MongoDB, Inc. to match its product.
Growth brought changes underneath. In December 2014 MongoDB bought WiredTiger, whose engine replaced the original storage layer. Atlas, a hosted database service, was announced in June 2016. In 2018 MongoDB added multi-document transactions in version 4.0 and moved the server from the AGPL to its own Server Side Public License, arguing that large cloud vendors were capturing the value of the project without contributing back.
Why it’s built this way
- Documents instead of rows and joins
- An order and its line items can live in one nested document, shaped like the object in the application. Documents in a collection don’t need the same fields, so the data can change shape without migrations.
- Atomic single-document writes, transactions much later
- If related data is embedded, one document write covers most updates. MongoDB estimated that 80–90% of applications don’t need multi-document transactions, and didn’t ship them until 2018.
- Replica sets and sharding in the server
- The founders had hit the limits of relational databases while scaling DoubleClick. MongoDB copies data to secondaries with automatic failover, and splits large collections across many replica sets by a shard key.
- Replace the storage engine underneath
- The original engine, MMAPv1, was replaced by WiredTiger, the default from 3.2 and the only engine from 4.2. MongoDB has said integrating WiredTiger was the first step toward transactions.
Timeline
- 2007
10gen is founded to build a cloud platform and starts the database
- 2009
First official release, 0.8, in February
- 2013
10gen renames itself MongoDB Inc.
- 2014
MongoDB acquires WiredTiger and its storage engine
- 2016
Atlas, the hosted database service, is announced
- 2018
Multi-document transactions in 4.0; licence changes from AGPL to SSPL
- 2025
Acquires Voyage AI for embedding and reranking models
- MongoDB: Our story
- mongodb/mongo on GitHub: tag r0.8.0, “first official mongo release” (Feb 2009)
- MongoDB press release: 10gen announces company name change to MongoDB, Inc. (Aug 2013)
- MongoDB press release: MongoDB acquires WiredTiger (Dec 2014)
- MongoDB 3.2 release notes: WiredTiger as default (Dec 2015) · archived copy, original
- MongoDB 4.2 compatibility changes: removal of MMAPv1 · archived copy, original
- MongoDB press release: MongoDB unveils MongoDB Atlas (Jun 2016)
- MongoDB blog: multi-document ACID transactions (2018)
- MongoDB: Server Side Public License FAQ
- MongoDB press release: MongoDB announces acquisition of Voyage AI (Feb 2025)
Sources9 · facts checked 5 October 2026
- MongoDB Community Edition licensing
- MongoDB: Server Side Public License FAQ (not OSI approved)
- MongoDB manual: Data modeling (flexible schema, embedding)
- MongoDB manual: Aggregation stages
- MongoDB manual: Indexes
- MongoDB manual: Limits and thresholds
- MongoDB manual: Transactions
- MongoDB manual: Replication (oplog, elections, asynchronous secondaries)
- MongoDB manual: Sharding