AZ-204 · Question #374
AZ-204 Question #374: Real Exam Question with Answer & Explanation
The correct configuration requires 'compositeIndexes' as the top-level policy property, since querying with ORDER BY on multiple fields requires a composite index in Cosmos DB - a regular index is insufficient. The sort order must match the query exactly: 'descending' for the fir
Question
Drag and Drop Question You are developing a new page for a website that uses Azure Cosmos DB for data storage. The feature uses documents that have the following format: You must display data for the new page in a specific order. You create the following query for the page: You need to configure a Cosmos DB policy to the support the query. How should you configure the policy? To answer, drag the appropriate JSON segments to the correct locations. Each JSON segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content. NOTE: Each correct selection is worth one point. Answer:
Explanation
The correct configuration requires 'compositeIndexes' as the top-level policy property, since querying with ORDER BY on multiple fields requires a composite index in Cosmos DB - a regular index is insufficient. The sort order must match the query exactly: 'descending' for the first field (matching the DESC in the ORDER BY clause) and 'ascending' for the second field (matching ASC or the default ascending order), because Cosmos DB composite indexes must mirror the exact sort direction of the query or its perfect inverse for the index to be utilized.
Topics
Community Discussion
No community discussion yet for this question.