Part 4 · 1 chapters · ~8 min
MongoDB Architecture
The document model and BSON byte level, the WiredTiger storage engine with B-trees, cache and compression, the journal and checkpoints, write and journal durability settings, collections and _id, document growth, MVCC snapshots, and multi-document transactions and their costs.
7
Documents on B-trees
code
// a document: an aggregate read and written together
{ _id: ObjectId("66f…"), owner_id: "u_7", currency: "NGN", balance_kobo: NumberLong(5000000),
limits: { daily_kobo: NumberLong(20000000) }, created_at: ISODate("2026-10-06T14:31:59Z") }
db.accounts.stats().wiredTiger.cache["bytes currently in the cache"]
db.serverStatus().wiredTiger.cache["pages evicted by application threads"] // rising = cache pressureMONGODB STORAGE: BSON AND WIREDTIGER
documents in collections, B-trees on disk, a cache and a journal
swipe the figure sideways, or tap expand for full screen
1/5
BSON
Documents are stored as BSON: binary JSON with types JSON lacks (int64, decimal128, dates, ObjectId, binary). Field names are stored in every document, so long names cost space.
typed binary JSONfield names repeated per document