couchdb - Why are there two ways to update documents? -


as couchdb beginner i'm having hard time understanding how update documents.

when read docs find quite confusing me:

1) updating existing document

to update existing document must specify current revision number within _rev parameter.

source: chapter 10.4.1 /db/doc

2) update functions

update handlers functions clients can request invoke server-side logic create or update document.

source: chapter 6.1.4 design documents

could please tell me way prefer update documents?


edit 1:

let's data structure simple car document basic fields.

{     "_id": "123",     "name": "911",     "brand": "porsche",     "maxhp": "100",     "owner": "lorna" } 

now owner changes, still use option 1? option 1 has quite downside, because can't edit 1 field. need retrieve every fields first, edit owner field , send whole document. tried , find quite long-winded. hmmm...

most of time want choose option 1 "update existing document"; operates on standard document stores data in database. other option relates design documents, such views (which documents, confusing new couchdb users), different.

stick option 1, , luck :)


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -