Running it for real
Production MongoDB runs as a replica set (copies on several servers), backs itself up, and is usually hosted on MongoDB Atlas. And sometimes the right answer is: use PostgreSQL.
The essentials
- Replica sets: one primary takes writes; secondaries copy it and take over if it fails.
- Write concern / read preference trade safety and speed (e.g. w: "majority").
- Transactions across documents exist (session.withTransaction) — but if you need them everywhere, your data may be relational.
- Sharding splits huge collections across servers by a shard key.
- Atlas: managed clusters, backups, monitoring, search and vector search.
- Choose MongoDB for varied, nested, fast-changing document shapes; content, catalogues, events, prototypes.
- Choose PostgreSQL for strongly related data, complex joins, strict integrity and transactions everywhere (it also has JSONB!).