couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirkjan Ochtman <>
Subject Re: Database design with CouchDB
Date Wed, 08 Dec 2010 12:47:09 GMT
On Wed, Dec 8, 2010 at 13:34, He Shiming <> wrote:
> So one database for one project, and one document for a kind of data
> huh? That's very helpful, thank you very much.

That's not exactly what I was saying. I have one document per user.

> One follow up question. Why do you use marker fields for each
> document, as opposed to just use "user" as the key for the "user
> document"? Does this have any advantage in view design?

An example: this app has two users, you and me. Documents:

{"_id": "dirkjan", "name": ["Dirkjan", "Ochtman"], "type": "user"}
{"_id": "he", "name": ["He", "Shiming"], "type": "user"}

Now I can easily build views that take the "document type" into
account (get all users), and I can easily make an atomic update of all
information related to one user.

Hope that helps,


View raw message