couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From He Shiming <heshim...@gmail.com>
Subject Database design with CouchDB
Date Wed, 08 Dec 2010 12:08:31 GMT
Dear CouchDB Community,

I'm familiarizing myself with CouchDB for a web project I'm working
on. I came from RDBMSs and I've got some question regarding database
design.

Take user logon / profile for example. When designing a SQL app, I
typically put a table with username, password column. Then use a
unique ID as foreign key, for user_profile table for names, addresses,
and user_avatar table for headshot blobs. Update cascades constraint
will keep them synced.

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".

I'm wondering if this is a good strategy towards database design with
CouchDB. Am I going to encounter any performance penalty or difficulty
if I follow this road?

Or is it better to have one "document" for "each kind of data", and
"each record" is just a "field"?

Thanks!
-- 
Best regards,
He Shiming,

Mime
View raw message