Courseiva

DP-900 Practice Question: Describe considerations for working with non-relational data on Azure

A gaming company stores player profiles in Azure Cosmos DB using the NoSQL API. Each profile is a JSON document containing fields like playerId, userName, level, inventory (an array of items), and friends (an array of playerIds). The application frequently needs to query all players that have a specific item in their inventory (e.g., 'sword'). Which Cosmos DB feature should they use to support this query efficiently?

⚠ Common exam trap

Many exam-takers confuse indexing features, thinking a composite index (Option C) is needed for array queries, when in fact composite indexes are for multi-property equality or range filters, not for array membership queries which require a wildcard index to index the array elements themselves.

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

Indexing policy with a wildcard index

A wildcard index in the indexing policy allows Azure Cosmos DB to automatically index all properties within a JSON document, including nested array elements like those in the 'inventory' array. This enables efficient queries such as 'SELECT * FROM c WHERE ARRAY_CONTAINS(c.inventory, {name: "sword"})' without requiring a custom composite index for each possible item. Without a wildcard index, the query would require a full scan of all documents, which is inefficient at scale.

Answer analysis

Option-by-option breakdown

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

  • Change feed

    Why it's wrong here

    The change feed is an ordered, durable log of document inserts, updates, and deletes, exposed as a stream of changes rather than a queryable index. It is designed to trigger downstream actions, such as synchronizing an external system or recomputing a materialized view, not to locate documents based on their current property values. Because it does not evaluate predicates like ARRAY_CONTAINS against existing documents, enabling the change feed would not help find player profiles whose inventory arrays contain a specific item.

  • Stored procedures

    Why it's wrong here

    Stored procedures are server-side JavaScript routines that run atomically inside the database engine, allowing multi-document transactions and complex business logic. However, they do not modify the indexing policy or the query planner's ability to use indexes; if you write a stored procedure to manually iterate over documents and check array contents, it effectively performs a linear scan, which is slower and more RU-intensive than a query served by an index. For an ARRAY_CONTAINS lookup, a stored procedure is therefore a loop, not an optimization.

  • Composite index

    Why it's wrong here

    A composite index in Cosmos DB is defined on a sequence of scalar properties, such as /region ASC and /lastLogin DESC, to efficiently serve equality, range, and ORDER BY queries across those particular fields. Importantly, composite indexes do not expand or index the individual elements of an array, so they cannot be used to satisfy an ARRAY_CONTAINS predicate that searches for a value inside an array. Even if you include an array path in a composite index, it will only support matching on the entire array, not on arbitrary elements within it, which is the specific capability that a wildcard index adds.

  • Indexing policy with a wildcard index

    Why this is correct

    Adding a wildcard index, such as /inventory/[]/? to the indexing policy, instructs Cosmos DB to index every element of the inventory array rather than only the first element, which is the default behavior. With that index in place, ARRAY_CONTAINS queries can use a targeted index seek instead of scanning every document, making the lookup both fast and cost-efficient in terms of request units. This is the correct configuration for a gaming company that frequently queries player profiles based on whether an array contains a specific item, because it directly aligns the index with the predicate.

About these practice questions

Courseiva writes every DP-900 question from scratch — 820 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 by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This DP-900 practice question is part of Courseiva's free Microsoft 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 DP-900 exam.