On Wed, Dec 8, 2010 at 13:08, He Shiming <[email protected]> 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
