For a single model query, we can apply conditional operations on the conditions defined in a query, where the and/or operator is applied to the series of conditions:
{ where: {<and|or>: [condition1, condition2, ...]}}
Is there a neat way to apply conditional operations for the models included in include?
As an example:
Model.find({
include: [
{
relation: "relation1",
scope: {
where: { condition1 }
}
},
{
relation: "relation2",
scope: {
where: { condition2 }
}
},
...
]
});
Is it possible to apply and/or operation on condition1, condition2 above, i.e. return all models such that they match the conditions defined in the scope of the included models.