Reputation: 1145
I have a set of data that looks like this:
I can go a super simple g.V('group_id').in('user').valueMap() to retrieve all the users and their properties. I can also retrieve the roles, but somehow, I can't retrieve all at once.
What I need to get is something like this:
==>{u={user_id=[474531d1], name=[User 1], email=[[email protected]]},r=[role A, role B, role C]}
==>{u={user_id=[474531d4], name=[User 2], email=[[email protected]]},r=[role A, role B]}
==>{u={user_id=[474531da], name=[User 3], email=[[email protected]]},r=[role C]}
I've tried with map, union, but either I get one set of things like users, or roles but never both.
Upvotes: 0
Views: 182
Reputation: 14371
I would think all you need is something like
g.V('group-id').
in('user').
project('user','roles').
by(valueMap()).
by(out('role').valueMap().fold())
Upvotes: 1