添加到JSON数组

时间:2019-09-30 17:03:57

标签: couchbase n1ql

如何使用N1QL将新元素附加到现有数组中?

[
{
  "address": "127.0.0.1",
  "time": 0
},
{
  "address": "127.0.0.1",
  "time": 0
}
]

1 个答案:

答案 0 :(得分:1)

您可以设置更新数据

 ARRAY_APPEND(field, { "adress":"127.0.0.1", "time":null }) 

 where "key you need to use as reference' = "referemce data"