Using @cascade with expand

While testing dgraph on Dgraph Ratel Dashboard I started testing the usage of @cascade with expand

So I try this and it works as expected:

{
  actors(func: type(Actor), first: 10) {
  	uid
  	name@.
  	dgraph.type
  	expand(_all_) @filter(type(Performance)) {
        dgraph.type
        performance.film {
        uid
        name@.
      }
	}  
  }
}

But if try to use @cascade it returns empty data, is that right?

{
  actors(func: type(Actor), first: 10) @cascade {
  	uid
  	name@.
  	dgraph.type
  	expand(_all_) @filter(type(Performance)) {
        dgraph.type
        performance.film {
        uid
        name@.
      }
	}  
  }
}

The query I’m trying to achieve is to return all the nodes of type Actor that has an edge with the type Performance.

You shouldn’t use cascade with expand All. Certainly, Dgraph will verify if all nodes have absolutely all predicates and edges(in a traverse context). And it will return empty just because none of the nodes found to match this logic.

Remove expand all from the equation and use a predictable query structure.

@MichelDiz I don’t know if I got right but I tried this and it didn’t work:

{
  actors(func: type(Actor), first: 10) @cascade {
    uid
    name@.
    dgraph.type
    expand(Actor) {
      dgraph.type
      expand(Performance)
    }  
  }
}

https://play.dgraph.io/?latest

The short answer to what I said is that cascade won’t work easily with expand functions (Actually I think that it doesn’t even work at all). So, don’t use it.

This bellow works.

{
  actors(func: type(Actor), first: 10) @cascade {
    uid
    dgraph.type
    actor.film {
      dgraph.type
      performance.film {
        uid
        name@.
      }
    }  
  }
}