user2691659
user2691659

Reputation:

Updating a Couch Document

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.

Upvotes: 0

Views: 806

Answers (1)

Dominic Barnes
Dominic Barnes

Reputation: 28439

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

Upvotes: 2

Related Questions