import Intro from '/docs/snippets/breaking-change-page-intro.md'
import MigrationIntro from '/docs/snippets/breaking-change-page-migration-intro.md'
Sorting by id is no longer possible to sort by chronological order in Strapi 5#
Sorting by id no longer works chronologically in Strapi 5 due to uuid-based documents; use createdAt with the Document Service API instead.
In Strapi 5, sorting by id to sort by chronological order is no longer possible since documents use an uuid.
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#
Manual procedure#
No manual procedure should be required as this will be handled by a codemod.