Courseiva
Data Modeling →easyMultiple Choice

C100DEV Data Modeling Practice Question

A developer is designing a collection to store catalog items. Different item categories have different attributes: books have 'isbn' and 'pageCount', while electronics have 'wattage' and 'warrantyMonths'. All items share '_id', 'name', 'price', and 'category'. Which data modeling approach best fits this requirement?

⚠ Common exam trap

The trap here is assuming that differing document shapes force separate collections, when a shared field set is the signal for the Polymorphic pattern.

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

✓

Store all items in one collection and include only the attributes relevant to each item's category.

The Polymorphic pattern stores documents with a shared core plus category-specific fields in one collection. It supports queries across all items using common fields and queries within a category using the discriminator field. This is the natural fit when different document shapes share a meaningful set of fields and are queried together.

Answer analysis

Option-by-option breakdown

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

  • ✓

    Store all items in one collection and include only the attributes relevant to each item's category.

    Why this is correct

    The Polymorphic pattern keeps documents with similar shared fields in one collection while allowing category-specific fields to differ. Queries across all items, such as by name or price, stay simple, and category-specific queries filter on the shared 'category' field. This matches the scenario's mix of common and divergent attributes.

  • ✗

    Create one collection per category, such as 'books' and 'electronics', and never query across them.

    Why it's wrong here

    Splitting into separate collections complicates any query that spans categories, such as finding items under a price threshold or searching by name. It also duplicates shared logic and indexes. The scenario explicitly notes shared fields, which is a signal to keep documents together rather than partition by category.

  • ✗

    Normalize all attributes into a separate 'attributes' collection referenced by item documents.

    Why it's wrong here

    Normalizing into a referenced collection requires a $lookup for nearly every read and adds join cost. The attributes are few and belong to the item, so referencing them is unnecessary overhead. This approach fits highly variable, shared, or large attribute sets, not the small category-specific fields described here.

  • ✗

    Store all category-specific attributes in a single 'attributes' array of key-value pairs for every item.

    Why it's wrong here

    A generic key-value array loses per-field typing and makes indexes and validation awkward. Queries become nested array matches, and sorting or range queries on numeric attributes are inefficient. While flexible, this approach sacrifices the schema clarity that the Polymorphic pattern preserves by keeping named fields.

About these practice questions

One of 259 original C100DEV practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.