Azure DocumentDB 获取集合中的分区键值

Azure DocumentDB get partition key values in collection

我想获取集合中的所有 PartitionKey 值。

数据库中的读取集合是通过 client.ReadCollections(database_link) 实现的,但我在 documentation and samples 中找不到与 ReadPartitions 类似的内容。

而且,我认为查询分区键 属性 的唯一值可能会有帮助,但是 DISTINCT is not available in DocumentDB.

可能吗?我更喜欢 Python SDK,但欢迎使用其他方法。

执行此操作的最佳方法是检索分区键的值,例如,使用 "SELECT c.partitionKey FROM c ORDER BY c.partitionKey",然后通过忽略重复值执行 Distinct 客户端,因为 DISTINCT 在文档数据库。