Reputation: 101
Now I am trying to query with multiple _and inside where in Strapi GraphQL playground. The query I am using is:
{
clients(
where: {
_and: [{ name: { _contains: "a" } }, { endDate: { _gte: "2017-12-31" } }]
}
) {
id
name
endDate
reasonForEnding
}
}
But getting an error with says the following:
"Error: Your filters contain a field '_and' that doesn't appear on your model definition nor it's relations".
How to do properly query with multiple _and conditions where clause in Strapi with GraphQL
Upvotes: 6
Views: 9741
Reputation: 405
Just adding to @Mohammad Sadeq Sirjani's answer; instead of and
, it is _and
. So in summary it would be:
clients(
where: {
_and: [{ name: { contains: "a" } },
{ endDate: { gte: "2017-12-31" } }]
}
) {
id
name
endDate
reasonForEnding
}
Upvotes: 2
Reputation: 650
clients(
where: {
and: [{ name: { contains: "a" } }, { endDate: { gte: "2017-12-31" } }]
}
) {
id
name
endDate
reasonForEnding
}
This is the answer
Upvotes: 3