Filter documents by nested / linked documents custom field value

Hey everyone :v:

Is it possible to filter documents by their linked documents custom field value? For example, i want to get all team members filtered by the location name "Hamburg".

{
  allTeam_members {
    edges {
      node {
        id
        name
        location {
          ... on Locations {
            name
            _meta {
              uid
            }
          }
        }
      }
    }
  }
}

Have a nice day :slight_smile:

Hello!

It is not possible to use the field of a linked document as an argument for filtering the response. These fields need to belong to the main document you’re querying (In this case would be “team_members”).

I don’t know how your locations Custom type is built but if it’s similar to a tag, then a Custom Tagging System is what you need.

After creating a custom Tag, you can then create a document and add the “Hamburg” text to it. Then in a query, you’ll just need to do a query by Content relationship field and pass the ID of the “Hamburg” custom tag.

@Pau thanks for your response.

I will try out your suggestion. I haven’t used the tags before.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.