DQL filter by the value of edge predicate

I think what you want is to start at user and go to video:

{
  q(func: type(User)) @filter(eq(status,1)) {
    ~created_by {
      url
    }
  }
}

however, if you must start at Video for some reason, you can use uid_in()

{
  uservar as var(func: type(User)) @filter(eq(status,1))
  q(func: type(Video)) @filter(uid_in(created_by, uservar)) {
     url
  }
}

At that point you may as well just write it as the single query. Up to you though.

Or you can use @cascade (but be wary of the performance implications thereof wrt pagination)

{
  q(func: type(Video)) @cascade(created_by) {
     url
     created_by @filter(eq(status,1))
  }
}
2 Likes