Skip to main content

What is a shard?

A shard is a separate server or node in a MongoDB cluster that holds only part of a collection's data. Together, all the shards form the complete store, but each one is responsible only for its own range of data.

Key characteristics

  • a shard holds not the whole collection, just a fragment of it
  • distribution happens by shard key
  • queries can reach a single shard, or run in parallel across several

Why a shard is needed

  • to split the load
  • to scale data volume
  • to speed up writes and reads through servers working in parallel

Summary

A shard = a separate node holding part of the data, used in a sharded cluster for MongoDB's horizontal scaling.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.