As a CouchDB beginner I'm having a hard time understanding how to update documents.
When I read the docs I find this which is quite confusing for me:
1) Updating an Existing Document
To update an existing document you must specify the current revision number within the _rev parameter.
Source: Chapter 10.4.1 /db/doc
2) Update Functions
Update handlers are functions that clients can request to invoke server-side logic that will create or update a document.
Source: Chapter 6.1.4 Design Documents
Could you please tell me which way do you prefer to update your documents?
Edit 1:
Let's say the data structure is just a simple car
document with some basic fields.
{
"_id": "123",
"name": "911",
"brand": "Porsche",
"maxHP": "100",
"owner": "Lorna"
}
Now the owner
changes, would you still use option 1? Option 1 has quite a downside, because I can't just edit one field. I need to retrieve every fields first, edit just the owner
field and than send back the whole document. I just tried it and I find this quite long-winded. Hmmm...