我有一个名为“update”的json,它有一个嵌入式列表“comments”,如下所示:
{
id: "update/0",
//comments contains elements with type:comment
comments: [{
id:"comment/0"
content:"old first level comment content..."
children:[{
id:"comment/00",
content:""old second level comment content...",
children[...]
}
]
}]
}
问题是:
1, How to append multiple comments to the embed list "comments" in one time operation?
答案 0 :(得分:1)
您可以使用union
- http://www.rethinkdb.com/api/javascript/union/
r.table("update").get("update/0").update({
comments: r.row("comments").union([comment1, comment2])
})