Describe the issue:
Trying to understand why these two queries return different values.
There’s a model, BlogPost
that references another model, BlogCategory
. Both are localised. The query’s goal is to filter by locale and to specifically get only the BlogPosts
that match a certain value ‘x’ of BlogCategory
.
The following query returns 0 values.
query X($locale: String!, $slug: String!) {
allDatoCmsBlogpost(
sort: {fields: meta___firstPublishedAt, order: DESC}
filter: {locales: {eq: $locale}, category: {slug: {eq: $slug}}}
locale: $locale
) {
edges {
node {
title
slug
readingTime
category {
title
slug
}
meta {
firstPublishedAt
}
content {
...(content stuff queried here)
}
}
}
}
}
If, instead of filtering category: {slug: {eq: $slug}}
we use filter: {locales: {eq: $locale}, category: {_allSlugLocales: {elemMatch: {value: {eq: $slug}}}}}
, then the expected values are returned.
Why do these two queries have such a difference in regards to what they return?
Thank you!