couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Alfke <>
Subject Re: View collation question
Date Fri, 29 Mar 2013 18:32:48 GMT

On Mar 29, 2013, at 10:56 AM, Troy Martin <> wrote:

> I'm wondering if I can use view collation to fetch the user and their associated groups
in one request to increase efficiency?

Sure; this is a pretty textbook example. Just write a map function that looks for group documents
and emits keys that are pairs of the form [userid, groupid]. Then to find a user’s groups,
query this view with a key range of startkey=[userid] and endkey=[userid, {}].

View raw message