Amos Bastian
10/13/2022, 10:11 PMEntry
to Campaign
. I want to find all entries connected to a given campaign. I thought I could just do
const entries = await ctx.prisma.entry.findMany({
where: {
campaigns: { every: { id: { equals: campaignId } } },
},
});
but this is returning entries that aren’t connected to any campaigns as well 😕
According to the docs this should only return every Entry
that has a Campaign
with the given id, or am I wrong? I can solve this by adding some: {}
to the filter (to exclude every Entry
without a Campaign
, but this seems unnecessary to me)Tim Shaker
10/14/2022, 12:42 AMconst entries = await prisma.entry.findMany({
where: { campaignId: 5 }
});
Nurul
10/14/2022, 7:09 AMsome:{}
before the every
clause is ideal and should work.Nurul
10/14/2022, 7:10 AMAmos Bastian
10/14/2022, 9:37 AM