Using Multiple Keys (>3 keys) for complicated queries

24 views
Skip to first unread message

rajath s k

unread,
Jan 21, 2016, 11:59:27 AM1/21/16
to Couchbase Mobile
Hi,

I am Rookie in CouchBase and need help/pointer for complicated queries.

How to use multiple keys for queries?

For example I have to get Employees from each Department who has worked on specific Project, or to get count of Projects each Employee has worked on.
Employee, Department, Project being stored as separate documents and I have docIds.

How to input keys, start and end keys to get this kind of View/Query?


Jens Alfke

unread,
Jan 21, 2016, 12:58:28 PM1/21/16
to mobile-c...@googlegroups.com
On Jan 15, 2016, at 3:20 AM, rajath s k <rockste...@gmail.com> wrote:

For example I have to get Employees from each Department who has worked on specific Project

Make a view that for each employee emits a key [projectID, employeeID]. Then query it with the startKey being [projectID], i.e. an array with the project ID you want to query, and the endKey being [projectID, {}], i.e. the startKey but with an empty dictionary appended.

Have you read the docs on querying?

—Jens
Reply all
Reply to author
Forward
0 new messages