Hi, I am trying to get only published entities using strapi.query or strapi.entityService I unpublished the entry but I am still getting it with above methods.
I also tried to use the filter against publishedAt field, but the field is always null.
What am I doing wrong?
let params = {
pLevel: getPopulateLevel(),
filters: {
locale,
//publishedAt: { $notNull: true }, //not working, will return no data.
//publicationState: 'live' //not working. Invalid key publicationState
},
populate: '*',
}
let content = await strapi.entityService.findMany(contentType, params);
//tried also "query". Same results.
//let content2 = await strapi.query(contentType).findMany({where: {publicationState:'live'}});
The data looks like this:
[
{
"id": 1,
"documentId": "kwk097smc85j9een8n7a48wh",
"message": "Lorem Ipsum",
"type": "info",
"start": "2024-09-28T22:00:00.000Z",
"end": null,
"createdAt": "2024-09-30T12:09:27.860Z",
"updatedAt": "2024-09-30T12:09:27.860Z",
"publishedAt": null,
"locale": "de"
}
]
What am I doing wrong? How can I get only published entities? (strapi 5.0.1)
This topic has been created from a Discord post (1290296390962118726) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord