【发布时间】:2020-12-08 07:01:54
【问题描述】:
背景:
我希望找到具有 "state" = "new" 且 length(Features.id) > 4 条件的整个 JSON 文档
{
"id": "123"
"feedback": {
"Features": [
{
"state": "new"
"id": "12345"
}
]
}
}
这是我试图做的:
因为这是一个嵌套文档。我的查询如下所示:
stackoverflow 成员帮助我访问了查询中的嵌套内容,但有没有办法获取完整文档
我用过:
SELECT VALUE t.id FROM t IN f.feedback.Features where t.state = 'new' and length(t.id)>4
这会给我ID。
我的愿望是在这种情况下访问完整的文档?
{
"id": "123"
"feedback": {
"Features": [
{
"state": "new"
"id": "12345"
}
]
}
}
感谢任何帮助
【问题讨论】:
-
尝试在选择查询中返回
f变量。 -
这样吗? SELECT VALUE f.id FROM t IN f.feedback.Features where t.state = 'new' and length(t.id)>4
-
如果您想要再次获取整个数据,就应该这样做。
SELECT VALUE f FROM t IN f.feedback.Features where t.state = 'new' ...
标签: sql arrays json azure azure-cosmosdb