Courseiva
Indexing →mediumMultiple Choice

C100DEV Indexing Practice Question

You are designing a schema for a social media platform where users have an array of 'tags' and an array of 'mentions'. You attempt to create an index on { tags: 1, mentions: 1 }. What is the most likely outcome of this operation?

⚠ Common exam trap

Candidates often assume MongoDB supports compound indexes with multiple array fields, forgetting that a single compound index cannot contain more than one array because it would require an exponential cartesian product.

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

✓

The index build fails with an error stating that a compound index cannot include more than one array.

MongoDB restricts multikey indexes such that a single compound index cannot cover more than one array field. This limitation prevents the index from growing exponentially in size, which would happen if it had to create a cartesian product of every element in both arrays. Developers must choose which array is more critical for query performance or use alternative indexing strategies.

Answer analysis

Option-by-option breakdown

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

  • ✗

    The index is created successfully and supports queries that filter by both tags and mentions.

    Why it's wrong here

    MongoDB explicitly forbids the creation of a compound multikey index that includes more than one array field. Attempting this operation results in an error because the number of index entries would be the product of the lengths of both arrays, leading to significant performance degradation and massive index storage requirements.

  • ✓

    The index build fails with an error stating that a compound index cannot include more than one array.

    Why this is correct

    A compound index can only contain one field that is an array to maintain a manageable index size. If you try to index two different array fields in one compound index, MongoDB returns an error to prevent the explosive growth of index entries that would occur from mapping every possible combination of elements.

  • ✗

    The index is created but only the first element of each array is indexed to save space.

    Why it's wrong here

    MongoDB multikey indexes are designed to index every element within an array, not just the first one. However, the restriction against multiple arrays in a single index is a hard constraint in the storage engine to prevent resource exhaustion. Indexing only the first element would not fulfill the requirements of a multikey index.

  • ✗

    The index is created but it will only be used if the query provides a specific index hint.

    Why it's wrong here

    Index hints can force the use of an existing index, but they cannot bypass the fundamental rules of index creation. Since the index itself cannot be created due to the multiple-array restriction, a hint would refer to a non-existent object. Proper schema design requires splitting these into separate indexes for each array.

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.