Cross partition query is required but disabled. Please set x-ms-documentdb-query-enablecrosspartition to true, specify x-ms-documentdb-partitionkey, or revise your query to avoid this exception.
Any suggestions?
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@sjbolinger Thanks for the question! We are investigating and will update you shortly.
I fixed the issue with two edits to the CosmostDBService.cs file, adding the EnableCrossPartitionQuery argument:
var todoQuery = docClient.CreateDocumentQuery
UriFactory.CreateDocumentCollectionUri(databaseName, collectionName),
new FeedOptions { MaxItemCount = -1, EnableCrossPartitionQuery = true })
.Where(todo => todo.Completed == false)
.AsDocumentQuery();
var completedToDoQuery = docClient.CreateDocumentQuery
UriFactory.CreateDocumentCollectionUri(databaseName, collectionName),
new FeedOptions { MaxItemCount = -1, EnableCrossPartitionQuery = true })
.Where(todo => todo.Completed == true)
.AsDocumentQuery();
@sjbolinger Thank you very much for posting the solution to this issue. I will have the content author review this and make an appropriate update to the sample solution. Thanks again.
@codemillmatt Looks like the customer identified an issue with this tutorial and wanted to bring this to your attention. Please let CXP know if there is a change you would like us to make. Thank you.
Fix merged into master of the azure sample. Thanks @SnehaGunda !!
Thank you @sjbolinger for finding it.
@sjbolinger in addition to the code sample, I made some fixes to the doc. We will now close this issues if there aren't further questions.