couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Update of "Transaction model use cases" by PaulDavis
Date Thu, 09 Apr 2009 15:21:26 GMT
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.'''''
  

Mime
View raw message