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集合中的多个分区
发布评论