I ran into an issue where I need to check if a user exists by his username and email since both are unique fields in the database, but I got an error.
Argument where of type UserWhereUniqueInput needs exactly one argument, but you provided username and email. Please choose one.
so, is there a way to execute this query just once?. instead of running one for each like the following
const user = await prisma.user.findUnique({
where: {
username,
email,
},
});
and not like this
const user = await prisma.user.findUnique({
where: {
username,
},
});
const user = await prisma.user.findUnique({
where: {
email,
},
});
username
andemail
required on yourUser
model or is one of them marked as optional with a?
in the Prisma schema? – Scurrile