Courseiva
Data Modeling →hardMultiple Choice

C100DEV Data Modeling Practice Question

Exhibit

db.collection.createIndex({ "tags": 1 })

Refer to the exhibit. You have a collection where each document contains a 'tags' array. If you frequently query for documents containing specific tags, what is the best way to model and index this data?

⚠ Common exam trap

Candidates frequently try to use a standard single-field index on an array, not realizing that MongoDB requires a multikey index to correctly index individual elements within an array structure.

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 multikey index created on the tags array.

MongoDB automatically creates a multikey index when you index an array field. This allows the query engine to efficiently find documents that contain any of the elements in the array. This index type is highly performant for tag-based filtering because it maps every element in the array to the document location, enabling rapid searches without scanning every document in the collection.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Convert the tags array into a comma-separated string.

    Why it's wrong here

    Storing tags as a string forces the engine to perform full-text searches or regex queries, which are significantly slower than multikey index lookups. You lose the ability to perform direct equality matches on specific tags, which negates the indexing benefits provided by MongoDB's native array support.

  • ✓

    Use the multikey index created on the tags array.

    Why this is correct

    Multikey indexes are the native way MongoDB handles array indexing. When an index is created on a field that contains an array, MongoDB automatically creates entries for each element, allowing for high-speed retrieval of documents based on specific tag values without any additional configuration or complex data restructuring.

  • ✗

    Create one index per tag value to ensure performance.

    Why it's wrong here

    Creating an index for every possible tag value is inefficient and unmanageable as the number of unique tags grows. This would create an enormous number of indexes, consuming excessive memory and slowing down write operations significantly, as every document update would require updating every single tag-specific index.

  • ✗

    Store tags in a separate collection and reference them using an object ID.

    Why it's wrong here

    While this is a normalized approach, it is unnecessary for simple tag lookups. The overhead of performing a join or an application-side lookup for every tag query is much higher than simply utilizing a multikey index on the array, which is purpose-built for this exact use case.

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.