MongoDB is the right database when your data is genuinely document-shaped, your schema changes frequently, or you need horizontal sharding built in. It is the wrong database when your data is relational, you need complex transactions, or you are choosing it just to avoid writing SQL.
When MongoDB Is the Right Choice
Variable document structure. The canonical MongoDB use case is data where different records have meaningfully different shapes. Product catalogs where electronics have voltage specs and clothing has sizes. CMS content where articles have different metadata than videos. Event logs where different event types have different payloads. For these use cases, a fixed relational schema requires awkward workarounds (nullable columns, EAV tables, JSONB abuse), while MongoDB's document model fits naturally.
Rapid schema iteration. In early-stage development, your data model changes frequently. Adding a field to MongoDB is free: just start writing it. Adding a column to Postgres requires a migration. For prototyping and MVP development where the schema is in flux, MongoDB removes friction. (Note: this advantage disappears once you have Mongoose schemas or Prisma models enforcing structure.)
JSON-native workflows. If your application primarily reads from and writes to APIs in JSON, MongoDB's document storage maps directly to your data structures without an ORM transformation layer. The data you receive from an API call is the shape you store, and the shape you store is what you return. This reduces impedance mismatch.
Horizontal scaling. MongoDB has built-in sharding: the ability to distribute data across multiple servers based on a shard key. Sharding Postgres is possible but significantly more complex (Citus, Vitess, or manual approaches). If you are planning for hundreds of millions of documents across multiple servers, MongoDB's sharding story is more mature.
When MongoDB Is the Wrong Choice
Complex relational queries. If your data has meaningful relationships (orders have line items that reference products, users belong to organizations that have projects), and you frequently need to query across those relationships, a relational database with JOINs is more efficient and expressive. MongoDB's $lookup (the equivalent of JOIN) is available but more verbose and less performant than SQL JOINs on well-indexed tables.
Strict consistency requirements. MongoDB's multi-document transactions (added in version 4.0) are available but add overhead. For financial transactions, inventory management, or any domain where atomicity across multiple documents is critical, Postgres's transaction model is more mature and battle-tested.
Your team knows SQL. Developer familiarity matters. If your team has strong SQL skills and MongoDB is a new technology to learn, the learning curve cost may outweigh any architectural benefit. Postgres with JSONB can handle most of the "flexible schema" cases that MongoDB is chosen for.