goddang
goddang
PPrisma
Created by goddang on 10/2/2024 in #help-and-questions
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
2 replies