I'm still very new to GraphQL and need some help s...
# prisma-whats-new
m
I'm still very new to GraphQL and need some help setting up a query by relationship... I have "actions" that get created by users. If I query all actions, I can get the list, which shows, for each action the id of the user that created it. Now, what I want to be able to query is all of the actions created by a user with ID "abcde12345", but I have no idea where or how to include this argument...
a
If an action has a user, that also means that a user has actions. So to get the actions for a user, you would start with the user:
Copy code
query($userId: ID) {
  User(id: $userId) {
     actions {
        fieldsYouNeed
     }
  }
}
💯 1
m
@agartha wow. never occurred to me... thanks!