在Azure Cosmos DB中,一旦我们决定一开始就可以稍后再更改分区键吗? [英] In Azure Cosmos DB, can we change partition key later on once we decided at the beginning

查看:79
本文介绍了在Azure Cosmos DB中,一旦我们决定一开始就可以稍后再更改分区键吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Cosmos DB的新手,我注意到我们可以根据需要设置分区键,以便通过这样的代码有效地扩展:

I am new to Cosmos DB and I noticed that we can set the partition key based on needs to scale effectively through code like this:

DocumentCollection myCollection = new DocumentCollection();
myCollection.Id = "coll";
myCollection.PartitionKey.Paths.Add("/deviceId");

问题是我们可以在创建集合并指定分区键之后再更改分区键吗?我可能会发现分区键的选择稍后不合适.

Question is can we change the partition key later on after we created the collection and specified the partition key? As I may find out that the choice of partition key is not proper later.

推荐答案

不支持更改分区键(请参见例如

Changing the partition key is not supported (see e.g. https://docs.microsoft.com/en-us/rest/api/cosmos-db/replace-a-collection). You would need to create a new collection.

这篇关于在Azure Cosmos DB中,一旦我们决定一开始就可以稍后再更改分区键吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆