Courseiva
Data Modeling →easyMultiple Choice

C100DEV Data Modeling Practice Question

A team is designing a schema for a product catalog where different product categories have entirely different attributes: books have ISBN and page count, electronics have wattage and warranty period, and clothing has size and material. All products must be searchable in a single query by name. Which data modeling approach best fits this requirement?

⚠ Common exam trap

The trap here is assuming that heterogeneous documents must be split into separate collections, when MongoDB is designed to handle varied shapes within one collection.

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 products in one collection, allowing each document to have its own category-specific fields alongside common fields.

The Polymorphic Pattern is the standard MongoDB approach when multiple entity types share some fields and a common query path but differ in their specific attributes. Keeping all products in one collection with shared fields such as name and category-specific fields lets a single indexed query serve the catalog search while preserving each category's natural structure.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Create a separate collection per product category and query them with $unionWith for every search.

    Why it's wrong here

    Separate collections per category force every catalog search to combine multiple collections with $unionWith, which is harder to index consistently and complicates pagination and sorting. It also prevents a single unified index on the product name across all categories, degrading the search experience.

  • ✗

    Normalize all attributes into a generic key-value array so every product has identical field names.

    Why it's wrong here

    Collapsing attributes into a generic key-value array loses type information, prevents targeted indexes on specific attributes like wattage, and makes queries and validation awkward. It also discards the natural document shape that MongoDB is designed to exploit, hurting both readability and query performance.

  • ✓

    Store all products in one collection, allowing each document to have its own category-specific fields alongside common fields.

    Why this is correct

    The Polymorphic Pattern stores documents of different shapes in one collection, sharing common fields like name and price while allowing category-specific fields. This lets a single indexed query on name retrieve all product types and is the idiomatic MongoDB approach for heterogeneous entities that share a common access path.

  • ✗

    Embed every possible attribute for all categories in each document, leaving unused fields null.

    Why it's wrong here

    Embedding every possible attribute across all categories produces sparse, bloated documents where most fields are null for any given product. This wastes storage, complicates schema evolution when new categories appear, and provides no query benefit over a polymorphic design with only the relevant fields present.

About these practice questions

This C100DEV question is part of Courseiva's 259-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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.