In Azure Cosmos DB, can we change partition key later on once we decided at the beginning

梦想的初衷 提交于 2019-12-23 07:27:42

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/45174311/in-azure-cosmos-db-can-we-change-partition-key-later-on-once-we-decided-at-the

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!