0
DocumentDbでは、親文書を取得するために子文書を検索できますか?どこの都市=「newcity」のような埋め込まれたデータを照会する方法はあり埋め込みデータdocumentDBを照会して親文書を取得する方法
{
"id": "7",
"name": "ACME Corp",
"location": [
{
"id": "c4202793-da55-4324-88c9-b9c9fe8f4b6c",
"city": "newcity",
"state": "ca"
}
]
},
{
"id": "35",
"name": "Another Corp",
"location": [
{
"id": "d33e793-da55-4324-88c9-b9c9fe8f4baa",
"city": "newcity",
"state": "ca"
}
]
}
:
ドキュメントエクスプローラでpublic class Customer
{
[JsonProperty(PropertyName = "id")]
public string Id { get; set; }
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
[JsonProperty(PropertyName = "locations")]
public List<Location> Locations { get; set; }
public Customer()
{
Locations = new List<Location>();
}
}
public class Location
{
[JsonProperty(PropertyName = "id")]
public string Id { get; set; }
[JsonProperty(PropertyName = "city")]
public string City{ get; set; }
[JsonProperty(PropertyName = "state")]
public string State{ get; set; }
}
、私はそうのように、このクラス構造体のインスタンスを1つ持っていることがわかりますstate = 'ca' 親データを取得しますか? SelectMany(x => x.Locations)を使用して子を照会すると、ルート(顧客)文書ではなくロケーションデータが取得されます。
おかげ
うわー、おかげ:
C#コードのデモを返し
! – wil