1

我有一个名为“update”的 josn,它有一个嵌入式列表“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? 
4

1 回答 1

1

你可以使用union——http ://www.rethinkdb.com/api/javascript/union/

r.table("update").get("update/0").update({
    comments: r.row("comments").union([comment1, comment2])
})
于 2014-03-21T06:32:54.370 回答