Courseiva
Data Modeling →hardMultiple Choice

C100DEV Data Modeling Practice Question

An IoT platform ingests temperature readings from thousands of sensors. Each reading is currently stored as its own document with sensorId, timestamp, and value, producing millions of tiny documents per day. Queries typically retrieve readings for a sensor over a specific hour. Which schema design most improves storage efficiency and query performance for this access pattern?

⚠ Common exam trap

The trap here is reaching for indexing or sharding to fix a problem that is fundamentally about document granularity and per-document overhead.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Use the Bucket Pattern, grouping readings from a sensor for a time window into a single document with an array of measurements.

The Bucket Pattern is purpose-built for time-series data, grouping measurements into documents keyed by a time window. Because queries retrieve a sensor's readings for a specific hour, a bucket per sensor per hour lets one document serve the query, slashes document count and overhead, and shrinks the index footprint, improving both storage efficiency and read performance.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Enable sharding on the readings collection with sensorId as the shard key and store one reading per document.

    Why it's wrong here

    Sharding distributes load across nodes but does not reduce the number of documents or their per-document overhead. Millions of small documents still consume disproportionate storage and index space, and a poorly chosen shard key can create hotspots, so this does not address the core efficiency problem.

  • ✗

    Add a compound index on sensorId and timestamp and continue storing one reading per document.

    Why it's wrong here

    A compound index accelerates lookups but does not fix the underlying problem of millions of tiny documents, each carrying per-document overhead such as the _id and field names. Storage remains inefficient and the sheer document count still burdens the query engine, so this is only a partial mitigation.

  • ✓

    Use the Bucket Pattern, grouping readings from a sensor for a time window into a single document with an array of measurements.

    Why this is correct

    The Bucket Pattern consolidates many readings into one document per sensor per time window, dramatically cutting document count and per-document overhead. Since queries target a sensor over an hour, a bucket keyed by sensorId and hour aligns perfectly, letting a single document read satisfy the query and reducing index size.

  • ✗

    Apply the Attribute Pattern by moving each reading's value into a key-value subdocument.

    Why it's wrong here

    The Attribute Pattern helps when documents have many rarely queried fields that would otherwise create large sparse indexes. Here the fields are few and consistent across readings, so converting values into key-value pairs adds complexity without reducing document count or improving the hourly per-sensor query.

About these practice questions

Courseiva writes every C100DEV question from scratch — 259 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official MongoDB exam blueprint

This C100DEV practice question is part of Courseiva's free MongoDB certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the C100DEV exam.