A client of mine has a use case/project that uses 2 content types.
Let’s name them “Reports” and “Companies”.
A report has a company fields which links/relates to content of a single company.
I’m trying to fetch reports, where company has “tag1” or “tag2” tags.
I’m using the following syntax in JavaScript:
const result = await client
.getEntries({
content_type: process.env.CTF_REPORT_TYPE_ID,
order: '-sys.createdAt',
'fields.company.metadata.tags.sys.id[in]': 'tag1,tag2',
limit: 4,
})
.catch(console.error)
Which will error out with following error:
Documentation:
If this isn’t the right way to look for tags in nested content types, could someone explain how to do this. I tried finding this use case in the documentation on how to solve this but without any luck.
Tries:
I don’t remember where exactly but I’ve read that I might need to provide the content_type for the company field, which I tried by adding:
'fields.company.content_type.sys.id': process.env.CTF_COMPANY_TYPE_ID,
Or also tried
'fields.company.content_type': process.env.CTF_COMPANY_TYPE_ID,
Which did not solve the issue at hand.
Help:
Any help would be greatly appreciated.
Thank you!