Query for "mutual friendship" (explicitly set in both directions)

This query looks like “Who of the friends of my friends is a mutual friend with me”. This should work fine. But as the way I was doing.

Yep, some bulk queries won’t work well. That’s why I have created this ticket Feature: Add foreach() function and FOREACH func in DQL (loops in Bulk Upsert) - please take a read to get what is happening. Is a long story.

BTW, the reason I have used a multi-blocks approach here is due to the fact that some variables won’t work in the same block or with multi-levels see Promise a nested block (under construction - I'm still working in the use case)

So, you have to use multi-blocks and do this one by one for now.

PS. BTW you can use cascade on my last query. So you gonna have just the mutual friends

{  
  G as var(func: eq(name, "User 7"))
  
 result(func: uid(G)) {
  name
  allFriends :friend @normalize @cascade {
    name:name
    friend @filter(uid(G)) {
      mutual : count(uid)
    }
   }
 }

}