在DocumentDb中,我應該如何對它進行分區?我應該使用partitionkey嗎?我認爲自收集之後我無法做到「/ address/state」......或者我能嗎? 我應該使用「/ Id」還是「/ name」?是因爲id是由documentDB生成的Guid,並且名稱幾乎總是唯一的,所以這些主要是獨一無二的。那麼我應該使用哪一個?我想我可能會按名稱查詢,但我認爲partitionkey應該是可以分組的文檔,例如州或城市或parentId。documentDB的分區鍵或無分區鍵
我應該不使用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; }
}
當業務可能有多個地址時,「/ address/state」將如何工作?它不會像「/ address [0]/state」嗎?如果我沒有嵌入位置,但將它作爲一個單獨的集合,MS支持告訴我使用'/ state'作爲分區鍵集合。組合越小越好。 – wil