I have a data structure similar to the one below:
[
{
"ID":"1",
"team":[
"team1",
"team2"
],
"group":[
"group1",
"group2"
]
},
{
"ID":"2",
"team":[
],
"group":[
"group1"
]
},
{
"ID":"3",
"team":[
"team1",
"team3"
],
"group":[
"group3"
]
}
]
Where I have a list of dictionaries, which have a list. I want to be able to run a query that iterates over the list like so:
for i in main_list:
for j in i.team:
# Code Here
for k in i.group:
# Code Here
But, when I try to do an UNWIND, such as the one below:
UNWIND main_list as i
MERGE (n:USER {id:i.id})
UNWIND i.teams as team
MERGE (t:TEAM {name:team})
MERGE (n)-[:BELONGS_TO]->(t)
WITH i,n
UNWIND i.groups as group
MERGE (g:GROUP {name:group})
MERGE (n)-[:BELONGS_TO]->(g)
RETURN count(main_list)
I think what the cypher query is doing is, but I'm not exactly sure.
for i in main_list:
for j in i.team:
# Code Here
for k in i.group:
# Code Here
What is the best approach to handle multiple inner loops?
Thanks!