Skip to main content

Scaling and Security for MongoDBs

MongoDB scaling and security covers sharding, which splits a collection across shards by a shard key, and the controls that protect a deployment: authentication, role-based access control, TLS and network restrictions. It closes the Operations stage and deals with growth beyond one replica set and with limiting who can read the data.

Stage: Operations · Part of the MongoDB roadmap · Last reviewed 19 November 2026

What to learn in Scaling and Security

Scaling and Security interview questions

What makes a good shard key in MongoDB?

A good shard key has high cardinality, spreads writes evenly and appears in common queries so they target one shard. A monotonically increasing key such as a timestamp sends all new writes to one shard, creating a hot spot. Hashed keys can fix that.

When should you shard instead of adding replicas?

Replicas add availability and read capacity, but every member holds all the data. Shard when the data or write load exceeds what one machine can handle even after vertical scaling and indexing. Sharding adds complexity, so it should not be the first step.

Where Scaling and Security fits in the MongoDB roadmap

Scaling and Security belongs to the Operations stage (advanced level), which takes about 12 hours. Reliability and scale.

Back to the full MongoDB roadmap