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.
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
Options
- A/product/category
- B/product/brand/tailspin
- C/product/brand
- D/product/[]/category
How the community answered
(26 responses)- A8% (2)
- B88% (23)
- C4% (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.
`/product/category` is a different top-level property and would not be indexed by a policy explicitly targeting paths under `/product/brand`.
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.
`/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.
`/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
Community Discussion
No community discussion yet for this question.
