Filtering getEntries result by nested field

Hi!

I have a model that is called product. Product has a reference field called country. Country has a title field.
I would like to request all products that belong to a specific country, matching it by title.

So this is what I tried:

client.getEntries({
  'fields.country.fields.title': 'Costa Rica',
  'content_type': 'producto',
  include: 2
})

But that returns an error. Is it possible to filter entries that way?

Thanks a lot for your help

Hi @emenaalt,

The issue is that you’re missing specifying the content type of the linked entry.

Here’s a good reference so that you can understand how you could structure that:

https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/search-on-references