如果我有这样的查询
SELECT part, meta(loc).id FROM `bucket` as loc
结果如下:
[{
"id": "loc_006b9cfc1ef849f68b694e35c99c4dfe",
"part": {
"name": "foo",
"partNumber": "1806-0085S"
},
} ...
但如果我想要这样的东西怎么办:
SELECT part, { meta(loc).id } FROM `bucket` as loc // won't work of course
我希望结果如下:
[{
// see, this guy wrapped in its own object
{ "id": "loc_006b9cfc1ef849f68b694e35c99c4dfe" },
"part": {
"name": "foo",
"partNumber": "1806-0085S"
},
} ...
答案 0 :(得分:2)
您可以使用:
SELECT part, { "id": meta(loc).id } AS some_alias
FROM `bucket` as loc