Hello,
I want to ask if it is possible to query data model by its input filed which is array of references.
I have this filed in the data model inputs:
And when i fetch the data from the builder io like this:
const getAllResources = await builder.getAll('resources', {
options: { enrich: true },
includeUnpublished: true,
});
i get the following response:
Now, what i want to do is to add query
to builder.getAll
request and query the response by tag id, because i have the id of the tag.
i tried something like this:
const getAllResources = await builder.getAll('resources', {
options: { enrich: true },
includeUnpublished: true,
query: {
'data.tags': {
$elemMatch: {
tag: {
id: tagId,
},
},
},
},
});
But i got empty array as a response …
Actually this question i relevant for the visual editor as well, because there is no way to filter from the admin panel as well, like this:
Even though i have these tags in some of the pages i get No content Found