Skip to content

[Request]: v3 to v4 migration guides for code that uses service.search and controller.count #892

@Archvia

Description

@Archvia

Summary

In strapi v3 services have a search method that can be used like in the example code for find.
The v3 to v4 guide does not give any hints on how to migrate such code to v4, where the search function is no longer available in the Entity Service API.

Likewise, in v3 controllers have a .count function that can be routed to like so:

...
"routes": [
    {
      "method": "GET",
      "path": "/restaurants/count",
      "handler": "Restaurant.count",
      "config": {
        "policies": []
      }
    }
...

There is also no documentation on how to migrate such routes, now that controllers no longer offer the .count function.

Why is it needed?

If you have v3 code shown in the above examples you get stuck when trying to upgrade to v4 because there is no clear upgrade path.

Suggested solution(s)

It would be helpful to have clear documentation on how to migrate common code examples that use v3 features that are not present in v4 to the new version.

Related issue(s)/PR(s)

No response

Metadata

Metadata

Assignees

Labels

issue: docs/instructionsIssues about incorrect instructions found on docs.strapi.iosource: Dev DocsPRs/issues targeting the Developer Docstarget: v4Documentation PRs/issues targeting content from docs.strapi.io (main branch).

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions