Sorting by id
is no longer possible to sort by chronological order in Strapi 5
In Strapi 5, sorting by id
to sort by chronological order is no longer possible since documents use an uuid.
This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.
🔌 Is this breaking change affecting plugins? | Yes |
---|
🤖 Is this breaking change automatically handled by a codemod? | Yes |
---|
Breaking change description
In Strapi v4
In Strapi v4, using the Entity Service API, you could do the following to sort entries by chronological order:
strapi.entityService.findMany('api::article.article', {
sort: 'id',
});
In Strapi 5
In Strapi 5, use the Document Service API to sort documents by chronological order, use the createdAt
field:
strapi.documentService.findMany('api::article.article', {
sort: 'createdAt',
});
Migration
This section regroups useful notes and procedures about the introduced breaking change.
Manual procedure
No manual procedure should be required as this will be handled by a codemod.