I've the following model which I'd like to model as a graph in Azure CosmmodDB.
So I have a user that can be in multiple groups, user can also have multiple permissions attached, groups can also have multiple permissions attached. I want to find an efficient query that starting from User, I get all the permissions attached (either directly attached or via a group). One thing to add is that user and group may be assigned to the same permission (and I want to get it just once). I came up with the query:
g.V().hasLabel('user').has('userid', '0_2147483647').repeat(out().simplePath()).until(hasLabel('permission'))
This query is not very efficient when there is much data, so the question is: can we make it better ?