incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Anderson" <>
Subject Re: Handling many-to-many type queries
Date Wed, 01 Oct 2008 04:55:11 GMT
On Tue, Sep 30, 2008 at 9:16 PM, Paul Barry <> wrote:
> Say I have 2 document types, User and Group.  A user can be in many groups
> and a Group can have many users.  So I store an array of group ids in each
> user document.  Is there a way to write a view that returns all of the group
> documents for a given user?

Not really - unless a user has tens of thousands of groups, I'd just
use GET requests to load each group document individually.

And/Or you could store the user_ids in the Group documents, and then
it'd be easy to emit them into a view from the group document.

Don't underestimate the power of requesting multiple docs (as long as
they are smallish).

There will be a feature added soon which allows you to fetch multi
docs in one request.

Chris Anderson

View raw message