couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Kilmer <>
Subject Query design questions
Date Wed, 08 Apr 2009 16:04:15 GMT
I have some design questions.  First about query design and then about
document design.

1. Query design:  We have a set of existing documents, Project, User,
and Membership.  Business constraints: A user is associated with many
projects through membership.  A user can also be marked as a project
owner through the membership. A project can also retrieve a list of
it's owners.  Given the constraints, some sample documents are:

{'id' : 'xxx'}
{'id' : 'yyy'}

{'id' :  'aaa'}
{'id' : 'ccc'}

{'user_id' : 'xxx', 'project' :  'aaa', 'is_owner' : true}
{'user_id' : 'yyy', 'project' :  'aaa', 'is_owner' : false}
{'user_id' : 'xxx', 'project' :  'bbb', 'is_owner' : true}
{'user_id' : 'xxx', 'project' :  'ccc', 'is_owner' : true}

What I'm wondering, is:

1. What is the easiest way to retrieve all the projects where a user
is the(an) owner? (our current implementation uses two queries)
2. What is the easiest way to retrieve all the owners for a particular project?

On another front, I realize the way the documents above are laid out
is 'very relational'.  I would love some ideas about on modeling the
relationships (should I even be using that word?) in a more document
centric manner.

Chris Kilmer

View raw message