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

ぃ、小莉子 提交于 2020-01-25 09:23:06

问题


I'm using .net core Cosmos Db Client nuget Microsoft.Azure.Cosmos v3.4.4

I need to query across partition 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

Can you help me?

Thanksss!


回答1:


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: https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/Microsoft.Azure.Cosmos/src/RequestOptions/QueryRequestOptions.cs#L156




回答2:


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.




回答3:


If you are using CosmosDB SDK v3 Cross Partition Queries are enabled by default.

There is no longer "FeedOptions", instead EnableCrossPartitionQuery is set automatically based on the query



来源:https://stackoverflow.com/questions/58633950/enable-query-across-partitions-on-microsoft-azure-cosmos-client

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!