I want to query all my foodtrucks filter by reservations.location.id AND by reservations.schedule.scheduleDate
I’ve read this post : Strapi graphql OR operator for where clause - #5 by sethpkendall
And I try to do that :
//Variables
{
"location": "60be40f06a15ab675c91f415", //Unil
"date":"2021-08-18"
}
query FoodtrucksReservationsLocation($location: ID!, $date: String!) {
foodtrucks(
where:{ _where:
[{reservations:{ location:{id:$location}}}, {reservations:{schedule:{ scheduleDate:$date}}}]
}
) {
id
title
reservations{
id
schedule {
scheduleDate
}
location {
title
id
}
}
}
}
This is my response :
"foodtrucks": [
{
"id": "60dd069029e9e8079ce717cd",
"title": "American's dinner",
"reservations": [
{
"id": "610b38177b13aa68a01e0992",
"schedule": {
"scheduleDate": "2021-08-18"
},
"location": {
"title": "Place de la Riponne",
"id": "60be40a26a15ab675c91f414"
}
},
{
"id": "610bdd5b7b13aa68a01e0993",
"schedule": {
"scheduleDate": "2021-08-20"
},
"location": {
"title": "Unil",
"id": "60be40f06a15ab675c91f415"
}
},
{
"id": "610bdd5d7b13aa68a01e0994",
"schedule": {
"scheduleDate": "2021-08-08"
},
"location": {
"title": "Vidy",
"id": "60be41226a15ab675c91f416"
}
}
]
},
{
"id": "610c02097b13aa68a01e0996",
"title": "Mexicana",
"reservations": [
{
"id": "610c31647b13aa68a01e099e",
"schedule": {
"scheduleDate": "2021-08-18"
},
"location": {
"title": "Place de la Riponne",
"id": "60be40a26a15ab675c91f414"
}
},
{
"id": "610c31af7b13aa68a01e099f",
"schedule": {
"scheduleDate": "2021-08-20"
},
"location": {
"title": "Place de la Riponne",
"id": "60be40a26a15ab675c91f414"
}
},
{
"id": "610c364b7b13aa68a01e09a0",
"schedule": {
"scheduleDate": "2021-08-08"
},
"location": {
"title": "Unil",
"id": "60be40f06a15ab675c91f415"
}
}
]
}
]
I get all foodtrucks, I shouldnt see the Mexicana foodtruck, it doesn’t have a reservations