Let's say I have a couchdb full of documents representing transactions e.g.
{
type: "transaction",
account: "bob",
date: "2008-11-22 21:01:00",
amount: 123.45
}
where amount can be positive or negative, representing a credit or debit
respectively
I want a view of balance by account and date i.e. given an account and
date, get the sum of all transaction amounts for that account, up to
that date.
Can this be done with only a couchdb view while meeting these requirements:
- no client logic
- no storing intermediate data in documents
- optimal use of incremental view updates (adding/updating a transaction
only invalidates view rows with same or later date)
If not, what's the best compromise that minimizes client logic?