I have a question related to my Prisma Schema. Bas...
# orm-help
c
I have a question related to my Prisma Schema. Basically, I have a one-to-many relation between "Team" and "User", but I want "Team" to list the userIds only. Not the whole Array of users like User[] . The screenshot illustrates the existing solution where "Team" list an Array of Users[]. How can I only reference the userIds?
r
@Christian Kozalla 👋 This is how 1-many relations are modelled in Prisma. If you would like to fetch the user id’s you can do the following:
Copy code
prisma.team.findMany({
  select { user: { select: { id: true } } }
})
I would suggest reading this as well on how to fetch relation data.
c
Okay, thank you very much! So it's not about the model, but how I query the data with the Prisma Client.👍
✅ 2