← thecodex.expert · The Codex Family of Knowledge
Databases

MongoDB

The leading document database. Flexible schemas, JSON-like documents, great for evolving data.

What is MongoDB?

MongoDB is a document database. Instead of tables with fixed columns, it stores flexible, JSON-like documents. Each document can have a different shape, which makes it easy to evolve your data as your app grows without rigid migrations.

When should you use it?

Choose MongoDB when your data is naturally document-shaped (a blog post with nested comments, a product with varying attributes), when your schema changes often, or when you want to start fast without designing tables up front. It is popular with JavaScript developers because documents look just like JS objects.

How to set it up

Run locally with Docker: docker run -p 27017:27017 mongo, or use the free hosted tier of MongoDB Atlas (their managed cloud) to skip setup entirely.

How it connects to your code

From Python use pymongo; from Node.js use the official mongodb driver or Mongoose. You work with collections of documents and query them with a JSON-like syntax: db.users.find({{"age": {{"$gt": 18}}}}).

MongoDB Reference Topics 12 planned

These are the topics planned for this reference. They are not written yet — the list is published so you can see what is coming. Everything already complete on this site is linked from the Languages section.

What is MongoDB Coming soon

Origin (2007, 10gen), document model, and where it fits vs. SQL.

Guide in progress
Installing MongoDB Coming soon

Local install, Docker, or the fully managed MongoDB Atlas.

Guide in progress
Documents and Collections Coming soon

MongoDB's equivalent of rows and tables — without a fixed schema.

Guide in progress
CRUD Operations Coming soon

insertOne, find, updateOne, deleteOne — MongoDB's core API.

Guide in progress
Querying and Filtering Coming soon

Query operators like $gt, $in, and nested-field matching.

Guide in progress
Indexes in MongoDB Coming soon

Single-field, compound, and text indexes.

Guide in progress
Aggregation Pipeline Coming soon

MongoDB's stage-based alternative to SQL's GROUP BY.

Guide in progress
Schema Design Patterns Coming soon

Embedding vs. referencing — MongoDB's core modeling decision.

Guide in progress
Transactions in MongoDB Coming soon

Multi-document ACID transactions since MongoDB 4.0.

Guide in progress
Replication and Sharding Coming soon

Replica sets for availability, sharding for horizontal scale.

Guide in progress
Performance Coming soon

Query planning, the explain() method, and index coverage.

Guide in progress
Connecting from Application Code Coming soon

Official drivers and ODMs like Mongoose.

Guide in progress