Jijin P
06/14/2021, 7:37 AMawait prisma.campaigns.findMany({
select:{
url:true
},
where: {
status:{
eq: 1
},
AND: {
{
// some conditions
},
{
// [BUG] relation based condition.
OR: [
{
offer_devices: undefined
},
{
// condition based on offer devices.
}
]
},
}
}
})
In this, if the offer_devices relation is null, then the condition is not working. I have tried to comment on the relation condition and it works.
Looks like this condition has the issue.
{
offer_devices: undefined
}Ryan
06/14/2021, 9:34 AMRyan
06/14/2021, 9:35 AMoffer_devices: null
Instead of undefined as both have different meanings and null is what you want to use for relations.Jijin P
06/14/2021, 9:53 AMJijin P
06/14/2021, 9:53 AMArgument offer_devices for where.AND.2.OR.0.offer_devices must not be null. Please use undefined instead.Jijin P
06/14/2021, 9:54 AM{
offer_devices: null
~~~~
}Ryan
06/14/2021, 10:03 AMawait prisma.campaign.findMany({
where: {
status: 1,
AND: [{ OR: [{ offer_devices: { none: {} } }] }],
},
})
This will find campaigns with no offer_devices.Jijin P
06/14/2021, 10:14 AM