【发布时间】:2017-08-01 13:42:06
【问题描述】:
在 DocumentDb 中,我应该如何对它进行分区?我应该使用分区键吗?我不认为我可以做“/地址/状态”,因为它的集合......或者我可以吗? 我应该使用“/Id”还是“/name”?这是一个好主意,因为 id 是由 documentDB 生成的 Guid 并且 name 几乎总是唯一的。那么我应该使用哪一个?我想我可以按名称查询,但我认为 partitionkey 应该是可以分组的文档,例如州、城市或 parentId。
我不应该使用 partitionKey 吗?这适用于我在 documentDb 中的 AspNetuser 模式用户表。我应该为 partitionKey 使用哪个属性?
public class Business
{
[JsonProperty(PropertyName = "id")]
public string Id { get; set; }
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
[JsonProperty(PropertyName = "description")]
public string Description{ get; set; }
[JsonProperty(PropertyName = "addresses")]
public List<Address> Addresses{ get; set; }
//more columns...
}
public class Address
{
[JsonProperty(PropertyName = "street")]
public string Street{ get; set; }
[JsonProperty(PropertyName = "city")]
public string City{ get; set; }
[JsonProperty(PropertyName = "state")]
public string State{ get; set; }
}
【问题讨论】:
标签: azure-cosmosdb