Attempting to keep this question as simple as possible... I'm currently thinking about using two (Couch) database views.
The signature of the first one looks a little like this;
{[username, group], value}
Which I can query with - startkey=[username]&endkey[username,{}]
...
The second of the two views will look like;
{[group, username], value}
Which I can similarly query with - startkey=[group]&endkey[group,{}]
Afaik, I cannot query a view with - startkey=[{},propertyName]&endkey[{},propertyName] - which is why I feel I need two views. The problem though, is how cumbersome it feels to create two views with keys that look so similar. The big advantage, of course, is that one of the two views will give me a simple, intuitive search for usernames, and the other will do the same for groups.
Both groups, however, will allow me to use a reduce function, to identify unique usernames in each respective group.
TLDR?
Can I use just one view to uniquely identify the number of users in each group, and alternatively use either the key 'group' or 'username' properties to query it?