MongoDB Sharding and Horizontal Scaling Flashcards
6 cards from real MongoDB practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 6 MongoDB Sharding and Horizontal Scaling flashcards as text
What is the difference between vertical scaling and horizontal scaling in the context of MongoDB?
Answer: Vertical scaling increases CPU/RAM on existing servers; horizontal scaling adds more servers (shards) to distribute data
Vertical scaling (scaling up) means adding more resources (CPU, RAM, storage) to a single server. Horizontal scaling (scaling out) means adding more servers. MongoDB sharding is a horizontal scaling strategy — adding shards distributes data and workload across multiple servers.
What does mongos do in a MongoDB sharded cluster?
Answer: Acts as a query router, directing client operations to the appropriate shards
mongos is a lightweight query router process. Applications connect to mongos as if it were a regular mongod. mongos consults the config servers for chunk metadata, routes operations to the correct shard(s), and merges results from multiple shards for scatter-gather queries.
What is the effect of choosing a low-cardinality field (e.g., boolean or status with few values) as a shard key?
Answer: It limits the maximum number of chunks, causing data to concentrate on few shards
Low-cardinality shard keys (e.g., a boolean or a status field with 3 values) limit the number of distinct chunk boundaries. MongoDB cannot split chunks beyond the number of unique shard key values, so data concentrates on a few shards regardless of how many shards exist.
What is the primary shard in a MongoDB sharded cluster?
Answer: The shard where unsharded collections in a database are stored
Every database in a sharded cluster has a primary shard that stores all unsharded collections in that database, as well as the initial chunks of newly sharded collections. The primary shard is assigned when the database is created and can be changed with movePrimary.
Which of the following is a recommended characteristic of a good shard key?
Answer: High cardinality and even distribution of values to prevent hot spots
A good shard key should have high cardinality (many distinct values), even distribution (values spread evenly across the data set), and query isolation (frequently queried with the shard key to enable targeted queries). High cardinality prevents jumbo chunks and ensures even chunk distribution.
What is change streams in the context of MongoDB sharding?
Answer: A real-time data stream that allows applications to subscribe to database changes across sharded clusters
Change streams provide an event-driven API for applications to subscribe to real-time data changes (inserts, updates, deletes, schema changes) in MongoDB. They work transparently across sharded clusters — mongos aggregates change events from all shards into a single ordered stream.
How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. Exam facts are checked against the official sources listed below. Not reviewed by a subject-matter expert. Editorial policy
Sources & references
Exam facts on this page (fees, format, dates, passing scores) are checked against these official sources; the date is our last check. Editorial policy
- 10geneducation.zendesk.com — Test dates, score release, passing score, test delivery, retake policy · verified Oct 2026
- learn.mongodb.com — Eligibility, fees, exam format, time limit · verified Oct 2026