You can use union
-- http://www.rethinkdb.com/api/javascript/union/
r.table("update").get("update/0").update({
comments: r.row("comments").union([comment1, comment2])
})
Question
I have a josn named "update",and it has an embedded list "comments" like this:
{
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[...]
}
]
}]
}
Questions are:
1, How to append multiple comments to the embed list "comments" in one time operation?
Solution
You can use union
-- http://www.rethinkdb.com/api/javascript/union/
r.table("update").get("update/0").update({
comments: r.row("comments").union([comment1, comment2])
})