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:
User
{'id' : 'xxx'}
{'id' : 'yyy'}
Project
{'id' : 'aaa'}
{'id' : 'ccc'}
Membership
{'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