exam questions

Exam AZ-204 All Questions

View all questions & answers for the AZ-204 exam

Exam AZ-204 topic 3 question 13 discussion

Actual exam question from Microsoft's AZ-204
Question #: 13
Topic #: 3
[All AZ-204 Questions]

DRAG DROP -
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 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.
Select and Place:

Show Suggested Answer Hide Answer
Suggested Answer:

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
kayleena93
Highly Voted 4 years, 5 months ago
ORDER BY queries on multiple properties: The composite index also supports an ORDER BY clause with the opposite order on all paths. So I think it's about reversed index to the query. Answer should be 'ascending'. You cannot support ASC (default), DESC query with DESC, DESC index.
upvoted 92 times
john4p
3 years, 4 months ago
The problem here is the SQL that makes many people think that "ORDER BY p.name, p.city DESC" means it's ordered by name and city both descending. But the DESC only applies to city. name is ASC - this would be less confusing: "ORDER BY p.name ASC, p.city DESC" Thus in the JSON you can only state ascending+descending or the opposite: descending+ascending. Since descending for name is already set the answer is "ascending". At first I had misread the SQL wrong myself and didn't understand kayleena's comment right away.
upvoted 35 times
Dobby92
1 year, 3 months ago
I just tried it. 1) Using Indexing Policy (name -> descending, city -> descending) gives an error: "The order by query does not have a corresponding composite index that it can be served from." 2) Using Indexing Policy (name -> descending, city -> ascending) works correcly, lists items. So yes, people above have right. - ASC is default for name, so query is equivalent to: SELECT * FROM People p ORDER BY p.name ASC, p.city DESC - "The composite index also supports an ORDER BY clause with the opposite order on all paths." https://learn.microsoft.com/en-us/azure/cosmos-db/index-policy#order-by-queries-on-multiple-properties
upvoted 5 times
...
...
[Removed]
1 year, 9 months ago
No. It supports, but it is not required. You can have (ASC, ASC), (DESC, DESC), (ASC, DESC), (DESC, ASC). So the answer is Descending
upvoted 2 times
neelkanths
1 year ago
answer is not descending
upvoted 2 times
...
...
...
GCMan
Highly Voted 4 years, 5 months ago
"name" field should be marked ascending (default if not specified). It's mislabeled
upvoted 35 times
cloud_exam1
4 years, 5 months ago
I think so. The answer is correct, but the name field should be marked ascending(default). We can find an example in the following link. https://docs.microsoft.com/en-us/azure/cosmos-db/how-to-manage-indexing-policy?tabs=dotnetv2%2Cpythonv3 https://docs.microsoft.com/en-us/azure/cosmos-db/how-to-manage-indexing-policy?tabs=dotnetv2%2Cpythonv3
upvoted 15 times
warchoon
2 years, 2 months ago
The client wants to walk with his back to the front. Who are we to tell him what to do?
upvoted 1 times
...
...
scottmct
4 years, 2 months ago
NO. Box 2 is "ascending" See explanation here: https://docs.microsoft.com/en-us/azure/cosmos-db/index-policy#order-by-queries-on-multiple-properties "The composite index also supports an ORDER BY clause with the __opposite order on all paths__." The table in the section also shows an example similar to this question.
upvoted 31 times
Rockm0uld
3 years, 1 month ago
the table also seems to suggest DESC followed by ASC is not supported by composite index? Confused
upvoted 2 times
Rockm0uld
3 years, 1 month ago
Looking again i think it refers to " What it will not support is non-matching clauses. if ASC, ASC or DESC, DESC will not match our question." as mentioned by edengoforit. Has to be opposites to make any sense.
upvoted 1 times
...
...
ArturKon
2 years, 7 months ago
I agree with you. For example index on (A asc, B asc) works for queries with ORDER BY (A asc, B asc) and (A desc, B desc). Not working with ORDER BY (A asc, B desc), (A desc, B asc) or even (B asc, A asc).
upvoted 1 times
...
[Removed]
1 year, 9 months ago
No. Box 2 is Descending
upvoted 1 times
...
...
...
4bd3116
Most Recent 8 months ago
{ "indexingPolicy": { "compositeIndexes": [ { "path": "/name", "order": "ascending" }, { "path": "/city", "order": "descending" } ] } }
upvoted 1 times
...
neelkanths
1 year ago
Got it on 20 April 2024...Marks > 900...All questions from examtopics 400 questions... This questions came in 3 exams me and my friend gave....and don't get confused with answer It is Composite indexes ascending as some people in comment have explained.. descending doesn't go....scored very good marks based on these answers
upvoted 6 times
...
Jass1nonly
1 year, 2 months ago
Composite Index Sample ORDER BY Query Supported by Composite Index? (name ASC, age ASC) SELECT * FROM c ORDER BY c.name ASC, c.age asc Yes (name ASC, age ASC) SELECT * FROM c ORDER BY c.age ASC, c.name asc No (name ASC, age ASC) SELECT * FROM c ORDER BY c.name DESC, c.age DESC Yes The 1st and 3rd lines have opposite order-by value, but the composite index (name ASC, age ASC) still supports them. The value for city should be ascending.
upvoted 1 times
...
Stann07
1 year, 4 months ago
Got that question on my exam DEC 18. went with given answer. scored 842. CAse Study : Van Arsdel inc.
upvoted 1 times
...
megp123
1 year, 5 months ago
The only way to confirm the answer is to try it out. "ascending" is the correct answer. "descending" - will result to "Message: {"Errors":["The order by query does not have a corresponding composite index that it can be served "
upvoted 3 times
...
bluetopp
1 year, 5 months ago
Just tested with proposed answer. If you run the query you will get the following error: {"Errors":["The order by query does not have a corresponding composite index that it can be served from."]} If you instead use "ascending" as the top voted answer here suggest, the query passes. So correct answer is: 1. compositeIndexes 2. ascending
upvoted 4 times
...
Vukile
1 year, 5 months ago
On exam 9 Nov 2023, went with given answer, socre 865. Case Study: Farmers and Distributors
upvoted 2 times
...
AndySmith
1 year, 6 months ago
On exam 3-Nov-2023. Selected: 1) compositeIndexes 2) descending
upvoted 2 times
...
p2006
1 year, 7 months ago
Got on 9/25/2023 compositeindexes ascending
upvoted 2 times
...
leviatas
1 year, 7 months ago
Got this quesiton in examn - 2023.09.25. Got Case Study Contoso
upvoted 1 times
...
mihailos
1 year, 8 months ago
Got it in exam 28/08/23. Went with proposed answer. Scored 912
upvoted 1 times
...
basquiat
1 year, 8 months ago
Got this one on 2023-08-08
upvoted 1 times
...
applepie
1 year, 9 months ago
got this question today, answer compositeIndex, descending - 7/30/2023, score 895/1000
upvoted 3 times
...
NightshadeRC
1 year, 9 months ago
Had this question today: 2023-07-26
upvoted 1 times
...
juanckar
1 year, 10 months ago
This was on the exam (July 2023). Went with proposed (city should be "asc"). Scored 917
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago