couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joscha Feth <>
Subject Re: Modeling question
Date Tue, 05 Jan 2010 18:01:06 GMT
On 05.01.10 18:49, Chris Anderson wrote:

> if you collate correctly and use startkey and endkey you will be be
> able to read just the relevant rows from the view. This should be
> practically instantaneous, so it's probably the right solution.

Actually this is only true for A's (I do this already), as any B or C 
does not necessarily have its own access field.
As it is not possible to temporary store variables in a map function, 
there is no way I can distribute the acl from a parent element (such as 
A or B) into a child element (B or C).
I could misuse reduce probably, but as this is discouraged, I did not 
even try.
Also an A does not have any information about its children, so when 
emitting an A (which will most likely contain the access information), I 
can not also emit that information for any child (B or C).
This makes using starkey and endkey only suitable for A's but not for 
any child element in the hierarchy.

Any other ideas?

> I mentioned before, but I'll mention again - if there's a way to
> achieve your business case without modeling a hierarchy (always an
> impedance mismatch with key value stores) you will simplify a lot of
> things. Not that it's impossible to do a hierarchy, but if you can get
> away without it, you'll have a lot less on your plate.

I've read that multiple times, but you know there are these times when a 
hierarchy just is needed.


View raw message