Filter on content relationship nested field


I'm using "@prismicio/client": "^7.1.0" and I would like to know if it's possible to filter on content relationship nested field.

I have two custom types: article and category.

  • article.category is a content relationship field
  • category.mysubfield = "a" | "b" | "c"

I would like to use client.getByType with a filters options like this:

filters: [filter.any("my.article.category.mysubfield", ["a", "b"])]

I've also tried to preload the categories and use an array of IDs, with in or any operator, but didn't work either:

filters: ["my.article.category",{ id }) => id))]

ps: I'm well aware of Content Relationship - Documentation - Prismic and @prismicio/client Technical Reference - Documentation - Prismic

Thank you for your time,

Filtering on nested fields within a Content Relationship is not supported directly but you can still query first level content from linked documents using REST



Thanks for your response.
Looks like there is no proper solution but I've managed to do with a combinaison of loading the sub collection and the any operator

        "my.article.category",{ id }) => id),
1 Like