You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by Apache Wiki <wi...@apache.org> on 2009/04/09 17:21:26 UTC

[Couchdb Wiki] Update of "Transaction model use cases" by PaulDavis

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The following page has been changed by PaulDavis:
http://wiki.apache.org/couchdb/Transaction_model_use_cases

The comment on the change is:
You can't use multiple docs to solve the multi-doc transaction issue.

------------------------------------------------------------------------------
   2. B+50$, balance = 1050$
   3. B+100$, update fails because B's revision is not the one being expected. Balance A(900), B(1050), 100$ short.
  
- '''''The proper way to do this is treat CouchDB as a ledger, with each line item as a new document. Then to do a transfer, you can have 2 new documents, one for account A with negative value, and one with account B with a positive value. Or a single document that shows the money subtracted from account and added to account B. Then to get the balance of an account, create a view of transactions by account and use a reduction to add up all the transactions for an account.'''''
+ '''''The proper way to do this is treat CouchDB as a ledger, with each line item as a new document. Then to do a transfer a single document that shows the money subtracted from account A and added to account B. To get the balance of an account, create a view of transactions by account and use a reduction to add up all the transactions for each account.'''''