在 documentdb 中,我可以跨集合加入并更新文档的分区键吗

In documentdb can i join across collections and update partition key for document

我刚刚在创建集合时添加了一个分区键 "/countryId"

  1. 是否可以更新文档的 countryId?

  2. 我可以在 documentdb 中跨集合加入吗?

Is it possible to update countryId for document ?

没有。一旦将某个属性指定为集合的 Partition Key,就无法更改。此外,您无法更改现有文档中 Partition Key 的值。您必须删除并重新插入具有新分区键值的文档。 不过您应该可以更改该值(比如将文档的 countryId 值从 1 更改为 2)。

Can i join across collections in documentdb ?

又不是。不支持跨集合查询。您需要做的是分别针对每个集合发出查询,然后在客户端处理数据。