On 12.04.2008, at 18:13, Guby wrote:
My first attempt was to store the user ratings in the entry itself,
and then use a for loop in the view to map the entry to each user
ID, but to store if the user has read the entry or not I would then
have to load the whole entry with all its ratings change the value
of one flag, and then save it all back. Seems like I would be
loading an awful lot of information and wasting a lot of
resources(?). Maybe I am trying to save computer cycles at the wrong
place. What I ended up doing instead is more a relational database
approach:
Now I have my entry document which only is the entry itself, and
then user_entry documents that have references to the entry, stores
the users rating and a flag wether or not it has been read and if
the rating passed the users threshold or not. It works perfectly
until I want to go from a list of user_entries to a list of entries.
If I load a list of user_entries that have a certain rating I have
to make a seperate call to the database to load each entry! That is
why I tried creating a view that would check the user_entry and the
return the qualified entries directly...
I you haven't read it already, I'd recommend looking at a blog post of
mine that explores this stuff:
<http://www.cmlenz.net/archives/2007/10/couchdb-joins>
Cheers,
--
Christopher Lenz
cmlenz at gmx.de
http://www.cmlenz.net/