0

如何插入吹文件

  {
      "author": "Vic Zhao",
      "text":  "hell..............."
  }

进入吹文档作为嵌入式数组注释的第一个元素

{
   name: 'Me',
   comments: [{
      "author": "Joe S.",
      "text": "I'm Thirsty"
   },
  {
      "author": "Adder K.",
      "text":  "old content"
  }]
}
4

1 回答 1

2

您可以使用前置操作http://www.rethinkdb.com/api/#js:document_manipulation-prepend

r.table(...).get(...).update({
    comments: r.row('comments').prepend(newEntry)
  }).run(conn, callback)

其中 newEntry 必须替换为您要插入的数据。

于 2013-06-18T16:56:15.493 回答