COSMOS DB集合中的多个分区

编程入门 行业动态 更新时间:2024-10-22 05:18:38
本文介绍了COSMOS DB集合中的多个分区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

1) I have a Cosmos DB collection with about 500k documents and which is Partitioned by a property "SITEID". In the Query Request Options only one partition key value can be passed. In my case I have queries where the SITEID in (1,2,3,4) needs to be executed where SiteID is the partition key. For example, My SP is as follows:

在c.SITEID IN("SiteId1","SiteId2","SiteId3","SiteId4","SiteId5")和c.STATUS IN("Status1","Status2")中选择* ,"Status3","Status4")

SELECT * FROM c WHERE c.SITEID IN ("SiteId1","SiteId2","SiteId3","SiteId4","SiteId5") AND c.STATUS IN ("Status1","Status2","Status3","Status4")

我正在使用下面的SQL API代码调用上面的SP.

I am Calling the above SP using the below SQL API code.

等待客户端.ExecuteStoredProcedureAsync(UriFactory.CreateStoredProcedureUri("DBName","CollectionName","Sample"),new RequestOptions {PartitionKey = new PartitionKey("SiteId1"))})

await client.ExecuteStoredProcedureAsync(UriFactory.CreateStoredProcedureUri("DBName", "CollectionName", "Sample"),new RequestOptions { PartitionKey = new PartitionKey("SiteId1") })

在上面的SQL API代码中,PartitionKey属性仅支持Single值.我需要传递几个分区值.还有其他选择吗?

In the above SQL API Code, PartitionKey property only supports a Single value. Where I need to pass several partition values. Is there any other options to do this?

2)"EnableCrossPartitionQuery";属性仅在FeedOptions中可用,而在Request Options类中则不可用. Client.ExecuteStoredProcedureAsync仅支持RequestOptions参数,而不支持FeedOptions.现在我需要执行一个存储过程 一次跨越所有分区.还有其他选项可以通过ExecuteStoredProcedureAsync方法传递EnableCrossPartitionQuery.

2) "EnableCrossPartitionQuery" property is only availbale in the FeedOptions but not in the Request Options class. Client.ExecuteStoredProcedureAsync only supports the RequestOptions parameter not FeedOptions. Now I need to execute a Stored Procedure at once and across all partitions. Is there any other options to pass EnableCrossPartitionQuery in ExecuteStoredProcedureAsync method.

例如)

client.CreateDocumentQuery(UriFactory.CreateDocumentCollectionUri("DBName","CollectionName"),从c选择*",新的FeedOptions {EnableCrossPartitionQuery = true}).ToList()

client.CreateDocumentQuery(UriFactory.CreateDocumentCollectionUri("DBName", "CollectionName"), "select * from c", new FeedOptions { EnableCrossPartitionQuery = true }).ToList()

等待客户端.ExecuteStoredProcedureAsync(UriFactory.CreateStoredProcedureUri("DBName","CollectionName","Sample"),new RequestOptions {PartitionKey = new PartitionKey("WGC")})

await client.ExecuteStoredProcedureAsync(UriFactory.CreateStoredProcedureUri("DBName", "CollectionName", "Sample"),new RequestOptions { PartitionKey = new PartitionKey("WGC") })

任何帮助都将非常有用.

Any help would be great.

推荐答案

Naveen,

Naveen,

我将为您提供一些资源进行审查:

I am going to provide you with a couple resources to review:

W 帽子是查询文档的建议方式 来自COSMOSDB中的不同分区?

What is the advised way to query documents from different partitions in COSMOSDB?

要完成的10件事了解DocumentDB分区集合

请让我们知道您可能还有其他问题.

Please let us know what additional questions you might have.

此致

迈克

更多推荐

COSMOS DB集合中的多个分区

本文发布于:2023-11-29 00:39:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1644604.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多个   分区   COSMOS   DB

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!