Data
MongoDB
The document database, used where flexible data earns it — with the honesty to say when PostgreSQL is the better choice.
Overview
MongoDB is the most widely used document database. Instead of storing data as rows in fixed tables, it stores flexible documents in a binary form of JSON called BSON, so a record can be a nested object with arrays, sub-documents and fields that vary from one document to the next. That flexibility is the whole point: where a relational database asks you to define a rigid schema up front and migrate it whenever the shape changes, MongoDB lets the shape evolve as your understanding of the data does. For domains where records are genuinely varied — product catalogues, content, event and telemetry data, user-generated payloads — a document maps to the thing you are storing far more naturally than a spread of joined tables.
Underneath the flexibility is a serious operational database. The aggregation pipeline gives you a composable, multi-stage way to filter, group, reshape and compute over documents on the server. Indexing covers single fields, compound keys, text, geospatial queries and more, so reads stay fast as data grows. Replica sets provide automatic failover and high availability, sharding partitions a collection across many machines for horizontal scale, and Atlas — the managed cloud service — runs all of that for you across the major cloud providers with backups, monitoring and security handled. Atlas Vector Search adds native storage and querying of embeddings, which makes MongoDB a practical home for the retrieval layer behind AI features rather than a second bolt-on database.
We are blunt about the most common mistake we see, because it is expensive: MongoDB is not a default replacement for a relational database. A great many applications reach for it because it felt easier to start with, then spend years fighting the absence of joins and transactions on data that was relational all along. If your data has clear entities with stable relationships between them — customers and orders and invoices — a relational database like PostgreSQL is very often the correct answer, and we will tell you so before you commit. MongoDB earns its place when the data is genuinely document-shaped or genuinely varied, not merely when someone wanted to avoid writing a schema.
Best for — Applications with genuinely document-shaped or highly varied data, or an evolving schema, on a JavaScript stack — and increasingly the retrieval layer behind AI features via Atlas Vector Search.
Why teams choose MongoDB
A data model that matches your data
When records are naturally hierarchical or varied, a document stores the whole thing in one place instead of scattering it across joined tables. Reads that would need several joins in SQL become a single document fetch, and the code that handles the data works with objects rather than reassembling rows.
Schema flexibility without blocking migrations
You can change the shape of new documents without an ALTER on a large table locking your database. For products still finding their shape, this means the data model follows the domain rather than gating every change behind a migration — a real advantage early on, provided it is governed rather than left to drift.
Horizontal scale and high availability built in
Replica sets give you automatic failover so a node loss does not become an outage, and sharding partitions a collection across many machines when a single server can no longer hold the working set. This scale-out path is native to MongoDB rather than bolted on, and Atlas operates it for you.
Why businesses choose MongoDB
- Your data is genuinely document-shaped or highly varied, and forcing it into relational tables would sprawl into sparse columns or a thicket of join tables that fight the domain.
- You are on a JavaScript or Node stack and want your database to speak the same shape as your application, cutting the object-relational layer out of the picture.
- You need native horizontal scale and automatic failover, and you would rather have Atlas operate replica sets and sharding than run that infrastructure yourself.
- You want senior judgement on whether a document database is even right — including being told plainly, before you commit, when PostgreSQL would serve your data better.
What we build with MongoDB
The capabilities this technology is genuinely strong at — and what we most often build with it.
Document data modelling
The single most important thing to get right on MongoDB is how you model documents: what to embed together for read performance versus what to reference to avoid unbounded growth and update anomalies. We design this deliberately around your actual query patterns — because the absence of joins means the model has to anticipate how data is read, and retrofitting a bad model is the most expensive mistake on the platform.
The aggregation pipeline
MongoDB’s aggregation pipeline processes documents through composable stages — match, group, project, lookup, unwind and more — to filter, reshape and compute on the server rather than pulling everything into the application. We use it for reporting, analytics and data transformation, and we design pipelines with indexes in mind so they stay fast rather than scanning entire collections.
Indexing strategy
MongoDB supports single-field, compound, multikey, text, geospatial and partial indexes. The wrong indexes — or none — turn every query into a collection scan; too many slow every write and inflate storage. We build indexes to match real query and sort patterns, verify them against explain plans, and treat the index set as something to maintain rather than set once.
Replica sets and high availability
A replica set keeps synchronised copies of your data across nodes with automatic failover, so the loss of a primary triggers an election rather than an outage. We configure read and write concerns to match how much consistency versus availability each workload actually needs, rather than accepting defaults and discovering the trade-off in production.
Sharding for horizontal scale
When a dataset or its write load outgrows a single machine, sharding partitions a collection across many. The shard key choice is effectively irreversible and governs whether load spreads evenly or hot-spots onto one shard, so we choose it carefully against access patterns — sharding a collection on the wrong key is one of the hardest mistakes to undo.
Atlas and Vector Search
Atlas is MongoDB’s managed cloud service, running replica sets, sharding, backups, monitoring and security across the major clouds so your team is not operating database infrastructure by hand. Atlas Vector Search stores and queries embeddings natively, which lets us build the retrieval layer for AI features — semantic search, RAG — in the same database that holds the underlying documents.
Use cases
Product catalogues and content
Catalogues where every product type has different attributes, and content systems with varied, nested structures — the classic case where a document holds the whole varied record cleanly and a relational schema would sprawl into sparse columns or endless join tables.
Event, activity and telemetry data
High-volume feeds of events, logs and activity where documents vary in shape and volume grows fast. MongoDB ingests flexible payloads without a fixed schema and shards horizontally as the data outgrows a single machine.
Node and JavaScript application backends
Backends on the JavaScript stack where storing and retrieving objects as documents removes the object-relational layer, and the data model maps directly onto what the application already works with.
AI retrieval and semantic search
The retrieval layer behind AI features — storing embeddings with Atlas Vector Search alongside the operational documents they describe, so semantic search and retrieval-augmented generation run against one database rather than a separate vector store.
When MongoDB is the right choice
- Your data is genuinely document-shaped or highly varied — catalogues where every product has different attributes, content management, event and activity feeds, or payloads whose structure you cannot fully predict up front. A document maps to these cleanly, where a relational schema would sprawl into sparse columns or endless join tables.
- The schema is still moving. Early-stage products and evolving domains benefit from being able to change the shape of a record without a blocking migration on a large table — MongoDB lets the model follow the product rather than gating it.
- You are building on a JavaScript or Node stack and want documents that map directly onto the objects your application already works with, avoiding the impedance mismatch and object-relational plumbing that a SQL database imposes.
- You need to store and query vector embeddings alongside your operational data for an AI feature — Atlas Vector Search lets the retrieval layer live in the same database as the documents it describes, rather than running a separate vector store.
- Wrong for: data that is fundamentally relational — clear entities with stable relationships, multi-row financial transactions, heavy reporting with many joins and aggregations across tables. MongoDB has no joins in the SQL sense and transactions have never been its strength; a relational database like PostgreSQL will serve this better, and choosing MongoDB here creates modelling problems you will pay for later.
MongoDB: pros and cons
Strengths
- The document model fits varied and hierarchical data naturally, and maps cleanly onto the objects in a JavaScript or Node application — less impedance mismatch, less object-relational plumbing.
- Schema flexibility lets the data model evolve without blocking migrations, which suits early-stage products and domains where records genuinely differ from one another.
- Horizontal scaling through sharding and high availability through replica sets are first-class features, and Atlas turns the operational burden of running them into a managed service.
- The aggregation pipeline is a genuinely capable analytics and transformation engine, and Atlas Vector Search puts embedding storage and similarity search in the same database as your operational data.
Trade-offs
- There are no joins or foreign-key relationships the way SQL has them. You either model data to be read together in one document, or you denormalise and duplicate it — and without discipline that denormalisation degrades into an inconsistent, hard-to-update mess. Relational data belongs in a relational database.
- Multi-document transactions exist now but have never been MongoDB’s strength. They came late, carry more overhead than in a relational engine, and if your workload leans heavily on them you have probably chosen the wrong database for the job.
- The schema flexibility that is a benefit early becomes a liability without governance. Nothing stops the same field being a string in some documents and a number in others, or the shape drifting release by release, until your application is littered with defensive code. Flexibility is not the absence of a schema — it just moves the schema into your codebase.
- Storing field names in every document costs storage and memory — a collection of many small documents repeats its keys millions of times, so working sets are larger than the equivalent normalised relational data unless you keep field names short and model deliberately.
Architecture
The load-bearing decision in any MongoDB system is the document model, and it is driven backwards from how the data is read. Because there are no cheap joins, you decide for each relationship whether to embed the related data inside the parent document — fast to read in one fetch, but risky if it grows without bound or is updated in many places — or to reference it by id and resolve it in the application or with a lookup stage. We make these calls deliberately against real access patterns, because the model is the hardest thing to change later and the one that most determines whether the system stays fast.
Around that model we design the index set to match query and sort patterns, choose read and write concerns per workload rather than accepting defaults, and — where sharding is in play — pick a shard key that spreads load evenly and avoids hot-spotting, knowing that choice is effectively permanent. We are equally willing to draw a boundary: if part of your system is strongly relational or transaction-heavy, that part often belongs in a relational database alongside MongoDB rather than being forced into documents. Using the right store for each shape of data beats forcing everything into one.
Performance
MongoDB is fast when the working set fits in memory and the queries are served by indexes — a document fetch by indexed key is quick, and embedding related data means a read that would need several joins in SQL becomes a single lookup. The failure mode is equally clear: an unindexed query scans the whole collection, and a working set larger than available memory pushes reads to disk and collapses throughput. We tune against real query plans with explain, add the indexes that matter, and design documents so the data read together lives together.
The honest caveats sit around storage and shape. Because every document repeats its field names, a collection of many small documents carries a real memory and storage overhead compared with normalised relational data, so we keep field names disciplined and model to avoid needless duplication. We also watch for the classic anti-pattern of unbounded array growth inside a document, which degrades performance as the document swells. Good MongoDB performance is a product of the data model as much as the hardware — a well-modelled collection outperforms a badly-modelled one on the same machine by a wide margin.
Security
MongoDB supports role-based access control, authentication, encryption in transit and at rest, and network isolation, and Atlas turns the operational side of that into sensible defaults — encrypted connections, IP access lists, and audit logging without hand-rolling infrastructure. We use least-privilege roles so an application account can touch only what it needs, keep clusters off the public internet behind private networking, and treat the connection string and its credentials as secrets managed properly rather than pasted into config.
The database’s controls do not absolve the application. The historical run of exposed MongoDB instances came from clusters left open with no authentication and bound to a public address — a configuration mistake, not a database flaw, and exactly the kind of thing we close off by default. Beyond that, injection through unsanitised query operators, over-broad roles, and unencrypted sensitive fields are all yours to own. We handle input validation, schema validation to constrain what documents may contain, and field-level encryption for the data that warrants it, because a secure MongoDB deployment is a product of configuration and application discipline, not the engine alone.
Scalability
MongoDB’s scale story is native. Replica sets let you scale reads and survive node failure, and sharding partitions a collection across many machines so both data volume and write throughput can grow past what one server holds — a horizontal path built into the database rather than bolted on afterwards. Atlas operates this for you, scaling clusters and rebalancing shards without your team running the infrastructure by hand, which is a large part of why teams choose the managed service.
The catch is that scaling well depends on decisions made early. The shard key is chosen once and is painful to change, and a poor key sends load to one shard while the rest sit idle, so we choose it against access patterns from the start. Document modelling matters too — unbounded arrays and ever-growing documents scale badly no matter how many machines you add. We design for the scale you will realistically reach rather than a hypothetical one, because premature sharding adds operational complexity you do not yet need, and late sharding on the wrong key is one of the harder problems to unwind.
MongoDB integrations & ecosystem
The technologies we most often pair with it — each links to how we work with it.
How we work
We start by pressure-testing whether MongoDB is the right store at all — and we will say if it is not, because forcing relational data into documents is the most common and most expensive mistake on the platform, and one we would rather you avoid than bill for. When MongoDB does fit, the first real work is the document model: we map your actual read and write patterns and decide what to embed versus reference before code volume grows, since that model is the decision everything else rests on and the hardest one to change later.
From there we build in thin vertical slices, each with its indexes, validation and query patterns considered rather than deferred, so the model meets real data feature by feature. The engineers who design the schema are the ones who write the queries and keep the database running — that is what operating what we build means. It shows up as disciplined field naming, schema validation to stop the model drifting into chaos, indexes matched to real plans, and a data layer your own team can own rather than one that depends on us to understand.
The service behind it
Delivered throughData EngineeringWhat we build with MongoDB
The disciplines this technology most often shows up in — from a first build to taking over and stabilising an existing one.
How we deliver
- 01
Discover
We map the system, the constraints and the business it serves — including the parts nobody documented.
Architecture brief
- 02
Architect
Decisions get made, written down and defended before a line of production code exists.
Decision records
- 03
Build
Short cycles against working software. You see progress in the product, not in a status deck.
Shipping increments
- 04
Operate
Monitoring, incident response and iteration. The system is alive, so the engagement is too.
Runbooks & SLOs
Industries we use MongoDB in
Domain knowledge changes what gets built. A few of the sectors we know before the first meeting.
Also in Data
Why teams choose us for MongoDB
Senior engineers only
MongoDB rewards good data modelling and punishes guesswork — the difference between a document model that stays fast and one that fights you is judgement earned on previous systems. There are no juniors learning embed-versus-reference on your production data.
We operate what we build
We run the databases we design, so we optimise for years of operation, not a demo: disciplined field naming, indexes matched to real plans, schema validation that stops the model drifting, and shard keys chosen to last rather than to be redone.
Honest about when not to use MongoDB
If your data is relational, we will tell you PostgreSQL is the better call before you commit, not after you have spent a year fighting the absence of joins. We would rather turn down a MongoDB project than build you one that should have been relational.
Typical timeline
- 01
Discovery and data modelling
One to two weeks confirming MongoDB is the right store, then designing the document model, embed-versus-reference decisions and index strategy against your real access patterns before code grows.
- 02
First vertical slice
Two to three weeks delivering one real capability end to end — documents, queries, indexes and validation — to prove the model against real data rather than a diagram.
- 03
Iterative build
Feature-by-feature delivery in short cycles, each shippable, with aggregation pipelines, indexes and schema validation handled as we go rather than deferred to the end.
- 04
Hardening and handover
Index and query-plan tuning, replica-set and (where needed) sharding configuration, a security and access-control review, and documentation so your team can own and extend the data layer.
How pricing works
- Fixed-scope builds for well-defined work — a new service and its document model, a schema and index design, or a migration onto or off MongoDB — quoted once we understand the data and access patterns.
- Monthly senior engagement for ongoing product work where the data model evolves with the product and you want continuity from the people who designed it.
- Focused audits and rescues for existing MongoDB systems — a model that has drifted into chaos, a performance problem from missing indexes or a bad shard key, or a mis-chosen database that would be better served relationally — priced by assessment.
Hire MongoDB engineers
Need MongoDB capacity on your own team? We embed named senior engineers into your existing team — reporting to your leads, working in your rituals — so you add capacity without a hiring cycle.
Hire MongoDB engineersCommon questions
Should I use MongoDB instead of PostgreSQL?
Usually only when your data is genuinely document-shaped or highly varied, or your schema is still moving fast. MongoDB is not a default replacement for a relational database, and a great many applications that reach for it would be better served by PostgreSQL — anything with clear entities and stable relationships, heavy reporting across joins, or multi-row transactions at its core. If you cannot point to a concrete reason a relational database fails your data, PostgreSQL is very likely the right answer, and we will say so before you commit.
How does MongoDB handle relationships without joins?
Two ways, and choosing between them is the core modelling decision. You either embed related data inside the parent document, so it is read in one fetch, or you reference it by id and resolve it in the application or with an aggregation lookup stage. Embedding is fast to read but risky if the related data grows without bound or is updated in many places; referencing avoids duplication but costs an extra lookup. There is no SQL-style join across the whole database, so the model has to be designed backwards from how the data is actually read — which is exactly why relational data is painful here.
Is schema flexibility a good thing or a trap?
Both, depending on governance. Early on, being able to change the shape of a record without a blocking migration genuinely helps a product still finding its form. Left ungoverned, it becomes a trap: the same field ends up a string in some documents and a number in others, shapes drift release by release, and your application fills with defensive code. Flexibility is not the absence of a schema — it moves the schema into your codebase. We use schema validation and disciplined modelling to keep the benefit without the chaos.
Can MongoDB do transactions?
Yes, MongoDB supports multi-document ACID transactions, but honesty matters here: they came relatively late, carry more overhead than in a relational engine, and have never been the platform’s strength. They are fine for the occasional operation that must be atomic across documents. If your workload leans heavily on multi-document transactions, though, that is usually a strong signal the data is relational and belongs in a database built around transactions — a document store is fighting its own grain to serve that pattern.
What is Atlas Vector Search and do I need it?
Atlas Vector Search lets MongoDB store and query vector embeddings natively, so you can run semantic search and retrieval-augmented generation against the same database that holds your operational documents rather than standing up a separate vector store. You need it if you are building AI features whose retrieval layer would otherwise live in a second database, and you already have — or would benefit from having — the underlying data in MongoDB. If your data is not in MongoDB and you have no other reason to put it there, a dedicated vector database may fit better; we will weigh that with you rather than assume the answer.
Building on MongoDB?
A technical conversation with the engineers who would do the work. If we are not the right fit, we will say so on the call.