P
Prisma3mo ago
goddang

Problem fetching relations where where-clause have same field name

I want to fetch a User object by username with all relevant followers and their user objects. Just one level, something like: { name, email, username, followers: [{name, email, username}, (name, email, username)] } I use the following code: const user = await prisma.user.findUnique({ include: includeStmt, where: { username: username, }, }) This however will only return any followers where username = username, i.e. the same as the User. Is there a way to achieve just filtering un User.username = username instead of all usernames in the query
1 Reply
Nurul
Nurul3mo ago
I didn't understand your question, do you mind sharing your schema file and elaborate on what you are trying to achieve?
Want results from more Discord servers?
Add your server