Updating a Couch Document

两盒软妹~` 提交于 2019-12-13 05:15:48

问题


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"}]

I want to add another user:

"users : [{"name" : "jane","lastname" : doe"}]

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" 

I tried the above which failed. So was wondering if there is a way to update couchdb documents by adding new stuff.


回答1:


You can use "update handler functions" to do partial updates of documents.



来源:https://stackoverflow.com/questions/23201765/updating-a-couch-document

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!