couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Metin Akat <>
Subject Re: Tree structure: how to calculate branch node sum, using results from a view that calculates leaf node sums.
Date Sat, 05 Sep 2009 06:34:51 GMT
One way I can think of is to bulk update all transactions "belonging"
to a leaf account when moving that leaf account around.
I can live with having to wait some time till this gets executed.
Is this "bad thinking" or is it OK to some extent?

On Thu, Sep 3, 2009 at 4:06 PM, Metin Akat<> wrote:
> Well, there is a problem with this. I don't like the idea of recording
> the whole path in each transaction, because it is anticipated that
> accounts are able to change places in the tree. So my TRANSACTION only
> holds information for only the "actual" account it's issued against,
> not for its whole lineage.
> On the other hand, ACCOUNTS do have the information for THEIR
> path(lineage), exactly as you suggested.
> So the problem now is making the connection between an account and its
> balance :)
>> query your reduce view with group_level=1 (or 2 or 3 .. depending on how
>> many level you want to descend into your tree). Your "path" to the root node
>> should be an array as in: ["toplevel", "firstlevel", "secondlevel"] as the
>> key of your view.
>> Cheers
>> Jan
>> --

View raw message