Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable query across partitions on Microsoft.Azure.Cosmos.Client

I'm using the .NET Core Cosmos DB Client NuGet package Microsoft.Azure.Cosmos v3.4.4

I need to query across partitions, but I haven't found how to do this like FeedOptions.EnableCrossPartitionQuery as described in the following article https://docs.microsoft.com/en-us/azure/cosmos-db/how-to-query-container

How do I enable cross partition queries?

like image 511
Murilo Maciel Curti Avatar asked Oct 30 '19 21:10

Murilo Maciel Curti


2 Answers

Cross partition queries are enabled by default in V3.

If you do specify a PartitionKey in the QueryRequestOptions, it becomes a single partition query.

Source code reference

like image 200
Matias Quaranta Avatar answered Sep 20 '22 09:09

Matias Quaranta


https://github.com/Azure/azure-cosmos-dotnet-v3/issues/731

The v3 SDK sets the EnableCrossPartitionQuery automatically based on the query and QueryRequestOptions.PartitionKey value. There is no need to set it in v3.

like image 29
Alex AIT Avatar answered Sep 21 '22 09:09

Alex AIT