System Information
Strapi Version : 4.3.6
Operating System : Windows
Database : postgreSQL
Node Version : v16.15.1
NPM Version : 8.11.0
Yarn Version : 1.22.19
the strapi or filter is working as and
this is an issue, is there any solution?
I also opened an issue regarding this. you can read full report here
opened 02:28PM - 02 Sep 22 UTC
## Bug report
- Node.js version: 16.15.1
- NPM version: 8.11.0
- Strapi ver… sion: 4.3.6
- Database: postgreSQL
- Operating system: Windows
### Strapi filter: "or" works as "and" in graphql
hello community!
I am troubled while wanted to use complex filter using "or" for two fields.
here firstly I wanted filter by slug and setting an or operator that if the first filter is not working, than the second operator which is filter by itSlug should run.
### Screenshots
#### this single filter is working

#### this complex query is not working

### Code snippets
```
query category($locale: I18NLocaleCode, $slug: String) {
categories(locale: $locale, filters: {slug: {eq: $slug}, or: [{itSlug: {eq: $slug}}]} ) {
data {
id
attributes {
categoryName
slug
description
locale
}
}
}
}
```
Convly
September 2, 2022, 3:08pm
4
Hi,
If you want to use or
, you need to pass all the targeted clauses inside its array, putting the or
next to another clause will create an and
clause between the or
components and the other ones.
Basically, what should work would be smth like: or: [{ slug: { eq: $slug } }, { itSlug: { eq: $slug } }]