I have the following filters in a Prisma query and I need to append a start_date: { equals: null }
in addition to the existing start_date: { lt: today }
, something like WHERE (id_1, id_2, id_3) IN ([array]) AND (start_date < today OR start_date IS NULL)
but I can't find a working solution.
where: {
OR: ids.map((id) => ({
id_1: id.1,
id_2: id.2,
id_3: id.3,
})),
start_date: { lt: today },
},
This options doesn't work:
- start_date: { OR: [{ lt: today }, { equals: null }] }
- start_date: [{ lt: today }, { equals: null }]
- AND: [{ start_date: { lt: today } }, { start_date: { equals: null } }]
CodePudding user response:
As you can only have one OR in an object, combine two filter objects with AND:
{ AND: [{ OR: /* ... */ }, { OR: [{ start_date: null }, { start_date: /*...*/ }] }] }