How can I write a query that gets nodes that have relationships to ALL nodes of a set. For example:
START n=node:people("username:*"),
g=node:groups("groupname:A groupname:B")
MATCH n-[:M]->g
RETURN n
This returns users that have relationships to A or B. But I want users that have relationships to A and B. I can't figure out how to do it though.
Edit:
I need to do this for an arbitrary number of groups, not just A and B. And the reason I'm using index syntax is that this is from user input, so it could be this:
START n=node:people("username:*"),
g=node:groups("groupname:*")
MATCH n-[:M]->g
RETURN n
And I would need to return users that have the M relationship with ALL groups.