nerdexam
Microsoft

DP-420 · Question #118

You have an Azure Cosmos DB database named database1 that contains a container named container1. The container1 container stores product data and has the following indexing policy. Which path will…

The correct answer is B. /product/brand/tailspin. Given an assumed indexing policy that includes all properties under /product/brand, the path /product/brand/tailspin will be indexed if tailspin is a nested property within the brand object.

Optimize an Azure Cosmos DB solution

Question

You have an Azure Cosmos DB database named database1 that contains a container named container1. The container1 container stores product data and has the following indexing policy. Which path will be indexed?

Exhibit

DP-420 question #118 exhibit

Options

  • A/product/category
  • B/product/brand/tailspin
  • C/product/brand
  • D/product/[]/category

How the community answered

(26 responses)
  • A
    8% (2)
  • B
    88% (23)
  • C
    4% (1)

Why each option

Given an assumed indexing policy that includes all properties under `/product/brand`, the path `/product/brand/tailspin` will be indexed if `tailspin` is a nested property within the `brand` object.

A/product/category

`/product/category` is a different top-level property and would not be indexed by a policy explicitly targeting paths under `/product/brand`.

B/product/brand/tailspinCorrect

If the indexing policy specifies a wildcard included path like `"/product/brand/*"`, it means that all properties nested under the `/product/brand` path will be indexed. Therefore, if a document contains a structure such as `{"product": {"brand": {"tailspin": "..."}}}`, then the path `/product/brand/tailspin` will be indexed.

C/product/brand

`/product/brand` refers to the `brand` property itself; if the policy is `/product/brand/*`, it indexes properties *under* brand, not the `brand` property as a scalar value itself.

D/product/[]/category

`/product/[]/category` implies an array of items with a `category` property, which is a different document structure not covered by an indexing policy focused on `/product/brand`.

Concept tested: Azure Cosmos DB indexing paths and wildcards

Source: https://learn.microsoft.com/en-us/azure/cosmos-db/index-overview#indexing-paths

Topics

#Azure Cosmos DB#Indexing Policy#Data Paths#Document Indexing

Community Discussion

No community discussion yet for this question.

Full DP-420 Practice