incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirkjan Ochtman <dirk...@ochtman.nl>
Subject Re: Database design with CouchDB
Date Wed, 08 Dec 2010 12:17:55 GMT
On Wed, Dec 8, 2010 at 13:08, He Shiming <heshiming@gmail.com> wrote:
> With CouchDB, I can basically setup just one database for "users".
> Each user has a "document" with UUID for key. The value is something
> like {"username": "johndoe", "password": "XXXX", "profile" {"name":
> "John Doe" ... }} . For headshots, I just make use of attachments.
>
> So it looks like I can have one "database" for "each kind of data",
> and one "document" for "each entry/record of data".

That's not the way I do it with CouchDB. I would either use a
per-application database or a per-user (per-project?) database,
depending on the kind of data you want to put in. For example, if you
have an app where users really only see their own data, and there's a
lot of it, you might want to have a per-user databases.

For my per-application databases, I just have user documents that have
some marker (I use a "type": "user" property on the documents,
usually). That is, each document specifies it's own type (that is, the
table it would have belonged to in your SQL-based database), and you
might for example have a design document per document type. A user
document will have the name, password and full profile.

Cheers,

Dirkjan

Mime
View raw message