可以使用 N1QL 吗?
例如我有这个:
{
"blog": "Coffee",
"user_id": 41,
"comments": [
{
"comment": "cup",
"user_id": 883
},
{
"comment": "water",
"user_id": 790
}
]
}
我想使用 N1QL 在评论中添加糖,结果如下: { "blog": "Coffee", "user_id": 41, "comments": [ { "comment": "cup", "user_id": 883 }, {“评论”:“水”,“user_id”:790 },{“评论”:“糖”,“user_id”:14 }] }
我试过这个:
UPDATE
Blog
SET
`c.comment` = "sugar",
`c.user_id` = 14
FOR
c IN comments
WHERE
`blog` = "Coffee"
// [{"code":3000,"msg":"syntax error - at WHERE"}
和这个:
UPDATE
Blog
SET
("comments", { "comment": "sugar", "user_id": 14})
WHERE
`blog` = "Coffee"
//[{"code":3000,"msg":"syntax error - at ("}