Hi,
I'm working on a Next.js project where articles have relations to other documents with type "tag" (basically a custom tagging system). I'm trying to build a page where all articles that have a relation to a "tag document" with a certain UID are listed.
I've tried to follow other threads, but nothing seems to work.
This is an example of an article structure, with tags beeing the custom tagging
{
"id": "ZVekVxIAACIAjvEh",
"uid": "new-incentives-from-...",
"url": null,
"type": "article",
"href": "https://...",
"tags": [],
"first_publication_date": "2023-11-20T12:19:57+0000",
"last_publication_date": "2023-12-11T10:05:18+0000",
"slugs": [],
"linked_documents": [],
"lang": "en-gb",
"alternate_languages": [],
"data": {
"data": "2022-02-07",
"title": "New incentives from...",
"old_content": ['...'],
"authors": ['...'],
"tags": [
{
"tag": {
"id": "ZVd6cBIAACAAjiQ2",
"type": "tag",
"tags": [],
"lang": "en-gb",
"slug": "medical-devices",
"first_publication_date": "2023-11-20T12:18:12+0000",
"last_publication_date": "2023-11-20T12:18:12+0000",
"uid": "medical-devices",
"data": {
"uid": "medical-devices",
"category": "",
"tag": [
{ "type": "paragraph", "text": "Medical Devices", "spans": [] }
]
},
"link_type": "Document",
"isBroken": false
}
},
{
"tag": {
"id": "ZVd6mxIAACEAjiV_",
"type": "tag",
"tags": [],
"lang": "en-gb",
"slug": "pharmacies",
"first_publication_date": "2023-11-20T12:18:24+0000",
"last_publication_date": "2023-11-20T12:18:24+0000",
"uid": "pharmacies",
"data": {
"uid": "pharmacies",
"category": "",
"tag": [{ "type": "paragraph", "text": "Pharmacies", "spans": [] }]
},
"link_type": "Document",
"isBroken": false
}
}
],
"slices": ['...'],
"meta_description": null,
"meta_image": {},
"meta_title": null
}
}
I've tried with this approach, but i'm not able to use "filter"
const test = await client.get({
predicates: [
predicate.at("document.tags.tag.uid", params.uid),
predicate.at("document.type", "article"),
],
orderings: {
field: "document.order",
direction: "asc",
},
});
Does anyone have any feedback?