How would you design a production MongoDB deployment on the cloud?

AdvancedProductionMongoDB
Answer

Short answer

A 3-member replica set spread across availability zones (or MongoDB Atlas), authentication + TLS, private networking only, sized so the working set fits in memory, continuous backups with PITR tested regularly, monitoring and alerting, and sharding only when one replica set can't handle the load.

Design points

Area Choice
Topology 3 data-bearing members in 3 AZs; optional analytics/hidden member for reports
Platform Atlas (least ops), or operator on Kubernetes / VMs with automation
Security Auth, least-privilege users, TLS, keyFile/x.509, Private Endpoint/VPC only, encryption at rest
Writes/reads w: "majority"; primary reads for critical data, secondary reads for analytics
Backups Continuous backup with PITR (Atlas / PBM), cross-region copy, monthly restore test
Capacity RAM for working set; fast SSD; oplog window ≥ 24–48 h
Monitoring Replication lag, oplog window, connections, cache usage, slow queries, disk
Schema/indexes Validators on key collections; indexes reviewed with Performance Advisor
IaC Atlas Terraform provider or operator CRDs in Git (GitOps)

What to say in the interview

"A three-zone replica set — on Atlas if possible — with auth, TLS and private networking only, majority writes, continuous backups with PITR and restore tests, monitoring of lag, oplog window and cache, all defined in Terraform or operator CRDs. Sharding only when vertical scaling and indexing aren't enough."

All Databases (MySQL, PostgreSQL, MongoDB) questions Roadmap: MongoDB basics

More on MongoDB