incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Candler <B.Cand...@pobox.com>
Subject Re: How do you handle multiple document groups?
Date Thu, 05 Nov 2009 15:45:30 GMT
On Thu, Nov 05, 2009 at 12:03:55PM +0100, Jan Lehnardt wrote:
>> For something like "myapp.com" domain and "users" database. I'll just
>> have to replace all periods with underscores or something.
>
> I wouldn't create databases per type.
>
> say user a has the domains foo.com and bar.com
>
> for that user the databases /a/foo_com/ and /a/bar_com
> are created. In these databases, all documents for the
> respective domain live. If you need additional info for
> the user that owns the domain that is not specific to
> the domain, I'd go with putting all user-specific info
> in each of the user's databases. This is duplication,
> but it doesn't really hurt, except maybe for users
> with hundreds and thousands of domains.

I'd say it depends what you mean by a "user"

If a user logs in as user@foo.com to get to the foo.com blog, and
user@bar.com to get to the bar.com blog, then each database probably should
have its own users table.

If you can login as user@example.com and you are 'attached' to both the
foo.com and bar.com domains as a user, then I'd say you'd need a single
users database, separate from the domain databases. The records in the user
database would list what domains the user is allowed to see. You can use a
map view to turn the data backwards, e.g. so that you can see which users
are allowed to access foo.com

Mime
View raw message