这是我在DocumentDb中的文档:
{
"id": 123,
"favoriteTeams": [
{
"id": 234,
"name": "Boston Celtics"
},
{
"id": 345,
"name": "Boston Red Sox"
},
{
"id": 456,
"name": "New England Patriots"
}
]
}
如果我通过门户网站运行以下SELECT语句,我会得到以下结果:
SELECT c.favoriteTeams FROM Collection c WHERE c.id = 123
结果如下:
[
{
"favoriteTeams": [
{
"id": 234,
"name": "Boston Celtics"
},
{
"id": 345,
"name": "Boston Red Sox"
},
{
"id": 456,
"name": "New England Patriots"
}
]
}
]
两个问题:
我不确定获取阵列是否能解决第一个问题,但我想至少尝试一下。我还想学习如何让团队参与其中 - 没有" favoriteTeams"结果中的对象。
答案 0 :(得分:0)
如果您更改了查询并添加了VALUE
关键字,那么您只需获取数组:
SELECT VALUE c.favoriteTeams FROM Collection c WHERE c.id = "123"
结果:
[
[
{
"id": 234,
"name": "Boston Celtics"
},
{
"id": 345,
"name": "Boston Red Sox"
},
{
"id": 456,
"name": "New England Patriots"
}
]
]