Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This page is part of the [Strapi v4 to v5 migration](/dev-docs/migration/v4-to-v
## Content API

* [Draft & Publish is always enabled](/dev-docs/migration/v4-to-v5/breaking-changes/draft-and-publish-always-enabled)
* [There is no `findPage()` method with the Document Service API](/dev-docs/migration/v4-to-v5/breaking-changes/no-find-page-in-document-service)

## Database

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: No findPage() in Document Service API
description: In Strapi 5, the Entity Service API is deprecated, and for the findPage() method you should use the Document Service API's findMany() method instead.
displayed_sidebar: devDocsMigrationV5Sidebar
tags:
- breaking changes
- document service
- entity service
---

import Intro from '/docs/snippets/breaking-change-page-intro.md'
import MigrationIntro from '/docs/snippets/breaking-change-page-migration-intro.md'

# No `findPage()` in Document Service API

In Strapi 5, the [Document Service API](/dev-docs/api/document-service) replaces the Entity Service API. There is no `findPage()` method available in the Document Service API and users should use the `findMany()` method instead.
<Intro />

## Breaking change description

<SideBySideContainer>

<SideBySideColumn>

**In Strapi v4**

In Strapi v4 you could use the `findPage()` method from the Entity Service API, for instance as follows:

```jsx
strapi.entityService.findPage('api::article.article', {
start: 10,
limit: 15,
});
```

</SideBySideColumn>

<SideBySideColumn>

**In Strapi 5**

In Strapi 5 the Entity Service API is deprecated and you should use the Document Service API instead. The [`findMany()` method](/dev-docs/api/document-service/sort-pagination#pagination) can be used as follows:

```jsx
strapi.documents("api::article.article").findMany({
limit: 10,
start: 0,
});
```

</SideBySideColumn>

</SideBySideContainer>

## Migration

<MigrationIntro />

### Manual migration

<!-- TODO: update this part — will there be a codemod? -->
In your custom code, replace any occurences of the Entity Service API's `findPage()` method by the `findMany()` method from the Document Service API.
3 changes: 2 additions & 1 deletion docusaurus/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,8 @@ const sidebars = {
id: "dev-docs/migration/v4-to-v5/breaking-changes"
},
items: [
'dev-docs/migration/v4-to-v5/breaking-changes/draft-and-publish-always-enabled'
'dev-docs/migration/v4-to-v5/breaking-changes/draft-and-publish-always-enabled',
'dev-docs/migration/v4-to-v5/breaking-changes/no-find-page-in-document-service',
]
},
{
Expand Down