To update an existing document you must specify the current
revision number within the _rev parameter.
For example:
PUT http://couchdb:5984/recipes/FishStew
Content-Type: application/json
{
"_rev" : "1-9c65296036141e575d32ba9c034dd3ee",
"servings" : 4,
"subtitle" : "Delicious with fresh salad",
"title" : "Fish Stew"
}
Alternatively, you can supply the current revision number in the
If-Match HTTP header of the request. For
example:
PUT http://couchdb:5984/recipes/FishStew
If-Match: 2-d953b18035b76f2a5b1d1d93f25d3aea
Content-Type: application/json
{
"servings" : 4,
"subtitle" : "Delicious with fresh salad",
"title" : "Fish Stew"
}The JSON returned will include the updated revision number:
{
"id" : "FishStew99",
"ok" : true,
"rev" : "2-d953b18035b76f2a5b1d1d93f25d3aea"
}For information on batched writes, which can provide improved performance, see Section 6.1.2, “Batch Mode Writes”.