AZ-303 Exam QuestionsBrowse all questions from this exam

AZ-303 Exam - Question 68


Note: This question is part of a series of questions that present the same scenario. Each question in the series contains a unique solution that might meet the stated goals. Some question sets might have more than one correct solution, while others might not have a correct solution.

After you answer a question in this section, you will NOT be able to return to it. As a result, these questions will not appear in the review screen.

You have an Azure Cosmos DB database that contains a container named Container1. The partition key for Container1 is set to /day. Container1 contains the items shown in the following table.

Exam AZ-303 Question 68

You need to programmatically query Azure Cosmos DB and retrieve Item1 and Item2 only.

Solution: You run the following query.

SELECT day -

WHERE value = "10"

You set the EnableCrossPartitionQuery property to False.

Does this meet the goal?

Show Answer
Correct Answer: B

The query provided would only retrieve items that have a 'value' field of '10'. In the given data, Item1 and Item3 have a 'value' of '10', but since the partition key for Container1 is set to /day and EnableCrossPartitionQuery is set to False, the query will only retrieve Item1 because it won't cross partitions. Therefore, the solution does not meet the goal of retrieving both Item1 and Item2.

Discussion

9 comments
Sign in to comment
mesk
Apr 4, 2021

given answer is correct, because value=15 for item 2. The query will retrieve item1 only.

azurellc
May 16, 2021

On exam 5/15/2021

nfett
Jun 15, 2021

answer is correct.

xaccan
Jan 4, 2021

No The query will retrieve item1 and item3.(value=10)

Motorzep
Jan 6, 2021

The answer is No. It will only retrieve item1 because EnableCrossPartitionQuery property was set to False.

erms
Jan 16, 2021

Actually xaccan is right, it will return Items 1 and 3. Please check what EnableCrossPartitionQuery really means.

erms
Jan 16, 2021

Actually xaccan is right, it will return Items 1 and 3. Please check what EnableCrossPartitionQuery really means.

kwaazaar
Mar 10, 2021

Will result in BadRequestException: Cross partition query is required but disabled.

AravindITGuy
Jun 21, 2021

Took exam today passed this morning was on there 6/21/2021

syu31svc
Aug 28, 2021

Answer is No for sure

st003
May 25, 2021

Same as questions 29. 30. 31. The answer is No.

pkr0895
May 27, 2021

EnableCrossPartitionQuery is automatically set based on the query. code: https://github.com/Azure/azure-cosmos-dotnet-v3/blob/e534de251bdadafd1adb960da83c15d463486a66/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs#L173-L177 doc:https://docs.microsoft.com/en-us/azure/cosmos-db/how-to-query-container