Get UID Based on Nested Value in DQL

I am trying to get the uid of a node, based on the value of the foreign key.

I have:

My GraphQL Schema (although I need to search in DQL)

type A {
  name: String!
 ...
}
type B {
  something: String
  apples: [A]
}

So, I have:

query {
  q(funct type(B)) @cascade {
    p as uid
    B.apples @filter(uid(0x321)) {
     uid
    }
}

So I have the uid of node A, and I need the uid of node B. I do not have an inverse relationship, so I can’t search from the reverse direction, which apparently also means I can’t use uid_in.

  • @cascade won’t work due to this bug, where I get more uids than I need, and it may not be the first result that has the correct uid.
  • I can’t just use eq(B.apples, uid(0x321)), which seems like it should work…

Surely there is a simpler way to accomplish this?

J

1 Like

This doesn’t work?

query {
  q(funct type(B)) @filter(uid_in(B.apples, 0x321)) @cascade {
    p as uid
    B.apples  {
     uid
    }
}
1 Like

That did it. Thank you sir!

Not sure why it didn’t work before…

J

2 Likes

BTW - In fact you don’t even need the cascade directive there.

2 Likes