How to update embedded document?

前端 未结 2 1655
自闭症患者
自闭症患者 2021-01-12 19:31

How to update the text of second comment to \"new content\"

{
  name: \'Me\',
  comments: [{
        \"author\": \"Joe S.\",
        \"text\": \"I\'m Thirsty         


        
2条回答
  •  一向
    一向 (楼主)
    2021-01-12 19:56

    Daniel's solution is correct. However, there are several open issues on Github for planned enhancements, including:

    • generic object and array modification (https://github.com/rethinkdb/rethinkdb/issues/895)

    • being able to specify optional arguments for merge and update (https://github.com/rethinkdb/rethinkdb/issues/872)

    • being able to specify a conflict resolution function for merge (https://github.com/rethinkdb/rethinkdb/issues/873)

    ...among other related issues. Until those are introduced into ReQL (particularly #895), Daniel's approach is the correct one.

提交回复
热议问题