I would like to be able to query by the slug of a linked field, currently only .id can be used.
allPrefectures(first: 100, filter: {region: {eq: "10101"}}) {
slug
name
position
region {
slug
name
id
position
}
}
For example, prefectures
references region
, and the prefectures inside a region are listed in a page /region/[region slug]
, currently, 2 queries are needed:
- region.slug -> lookup and find region.id
- fetch all prefectures under that region by allPrefectures(first: 100, filter: {region: {eq: “[region.id]”}})
It would be great if we can query records directly by slugs of linked fields. This kind of lookup should be quite common for hierarchy based listings, like category > articles, tags > articles, main category > sub category > shop item etc.