Here it has example
And then in
https://payloadcms.com/docs/queries/overview#graphql-find-queriesit says
"All GraphQL find queries support the where argument, which accepts queries exactly as detailed above."
But in grapql types it has just XXX_where_or and XXX_where_and, which are just same as XXX_where
How to search for blog posts like "_status: {equals: pubslihed} , category: {equals: 'xxx'} AND (title: {contains: 'term'} OR body: {contains: 'term'})"?
@itspers have you seen the GraphQL Playground yet? You can go to
/api/graphql-playground
and see full docs into your schema and API, details here
https://payloadcms.com/docs/graphql/overview#graphql-playground. Looking in the playground I can see that the
where
argument can contain the
OR
and
AND
properties. So your example should look something more like this:
query Page($category: String, $term: String) {
Pages(where: { AND: { _status: { equals: published }, category: { equals: $category }}, OR: { title: { contains: $term }, body: { contains: $term } }}) {
docs {
id
}
}
}
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.