Patrick
10/22/2021, 5:13 PMPatrick
10/22/2021, 5:16 PMMaciek K
10/22/2021, 5:19 PMawait ctx.db.post.findMany({
where: {
author: {
email: "<mailto:test@example.com|test@example.com>"
},
},
})
or this one, not sure. Try :)
await ctx.db.post.findMany({
where: {
author: {
is: {
email: "<mailto:text@example.com|text@example.com>"
}
}
}
}
Patrick
10/22/2021, 5:30 PMconst settings = await ctx.db.settings.findFirst({
where: { user: { email: "<mailto:test@example.com|test@example.com>" } },
});
Patrick
10/22/2021, 5:31 PMMaciek K
10/22/2021, 5:34 PMsettings
in the schema you pasted, I think that's schema from Prisma docs. Maybe paste your schema. In the original question you were asking about Post[] arrayPatrick
10/22/2021, 5:35 PMPatrick
10/22/2021, 5:37 PMMaciek K
10/22/2021, 5:46 PMPatrick
10/22/2021, 5:48 PMMaciek K
10/22/2021, 5:49 PMMaciek K
10/22/2021, 5:50 PMMaciek K
10/22/2021, 5:54 PMPatrick
10/22/2021, 5:58 PMMaciek K
10/22/2021, 6:03 PMPatrick
10/22/2021, 6:05 PMPatrick
10/22/2021, 6:05 PMMaciek K
10/22/2021, 6:21 PM@unique
at userId
is not needed probably.
Btw sometimes if I need to query something very often, I prefer to store it closer to the queried model. Just to limit unnecesary relation queries. LIke in your case:
model User {
isEnabled Boolean @default(false)
}
Patrick
10/22/2021, 6:51 PM