更新沙发文档 [英] Updating a Couch Document
问题描述
假设我在服务器上托管了一个现有的Sofadb JSON文档。我想使用PUT向该文档中添加一些数据,我该怎么做?可以说文档已经具有以下数据:
Assuming i have an existing couchdb JSON document hosted on the server. And i want to add some data to that document using PUT how can i do that ? Lets say the document has the following data already :
"users : [{"name" : "John","lastname" : doe"}]
我要添加其他用户:
"users : [{"name" : "jane","lastname" : doe"}]
可以用 curl
和 PUT
完成吗?假设我从服务器获取文档的doc ID,并执行以下操作:
Can this be done with curl
and PUT
? assuming i get the doc id of the document from the server and do something like :
curl -X PUT -d $new http://127.0.0.1:5984/database/$documentid"
我尝试了上述操作,但均失败了。因此,我想知道是否有一种方法可以通过添加新内容来更新beddb文档。
I tried the above which failed. So was wondering if there is a way to update couchdb documents by adding new stuff.
推荐答案
您可以使用 更新处理程序函数以对文档。
You can use "update handler functions" to do partial updates of documents.
这篇关于更新沙发文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!