incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Bangert <...@groovie.org>
Subject Re: Associating users and comments
Date Wed, 01 Oct 2008 17:01:31 GMT
On Sep 30, 2008, at 7:26 PM, Paul Davis wrote:

> 1. To prevent the need to re-update all your sub-records, use a
> uniquely identifying piece of data that doesn't change. Ie, use the
> user docid instead of slug. This prevents you from being able to
> display a post without fetching the user doc, but getting the whole
> shebang in one get should alleviate that. (as was the original
> intent).

Yes, I was planning on having comments reference the CouchDB assigned  
ID of the user, as well as the ID of the document its commenting on.  
While I understand that somehow a map/reduce will help me assemble  
this information, the lack of examples and docs on what exactly is  
going on is making it difficult to see how I'd actually write it.

> 2. You're right that you the view count only gives you that many rows,
> regardless of what type. For the first "Give me back 5 customers with
> their orders" I'd do a reduce with group_level=1 and sum the rows,
> then a second get to get that many rows from the view. The second
> question about getting the latest 5 orders for each customer would
> require a different view probably. I have the feeling it should be
> doable with a clever emit, but I'm a bit tired so its not
> materializing.

I haven't seen any map/reduce examples that do such combinations of  
data. Does anyone have some pointers to map/reduce examples that  
return data mingled together like this?

Cheers,
Ben
Mime
View raw message