Cloud Parts

MongoDB

A document database that stores JSON-like records with a flexible schema, from one replica set to a sharded cluster.

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

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

How to read a benchmark →
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

  1. 2007

    10gen is founded to build a cloud platform and starts the database

  2. 2009

    First official release, 0.8, in February

  3. 2013

    10gen renames itself MongoDB Inc.

  4. 2014

    MongoDB acquires WiredTiger and its storage engine

  5. 2016

    Atlas, the hosted database service, is announced

  6. 2018

    Multi-document transactions in 4.0; licence changes from AGPL to SSPL

  7. 2025

    Acquires Voyage AI for embedding and reranking models

Sources9 · facts checked 5 October 2026

Improve this page on GitHub