gpt4 book ai didi

java - 使用分区键查询cosmosdb

转载 作者:行者123 更新时间:2023-12-01 14:07:58 25 4
gpt4 key购买 nike

我有一个员工 dto,其partition 作为分区键。

  1. 如何获取任意给定时间点的分区数量?
  2. 如何使用partitionKey查询cosmosdb(documentDB),查询浏览器或java api都可以?

我尝试过的:

List<Document> documentList = documentClient.queryDocuments(getCollection().getSelfLink(),"SELECT * FROM root r WHERE r.partitionKey ='" + partitionKey+"'", null).getQueryIterable().toList();

我最终从 java api 获得 IllegalStateException 状态异常,并且查询导出器也没有给出任何输出。任何帮助都非常值得赞赏。

最佳答案

部分答案:

由于Partition Key属性的名称是department,请将您的查询更改为:

List<Document> documentList = 
documentClient.queryDocuments(
getCollection().getSelfLink(),
"SELECT * FROM root r WHERE r.department ='" +
partitionKey + "'", null).getQueryIterable().toList();

关于java - 使用分区键查询cosmosdb,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44136711/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com