Moving from v3 to v4: default find-Services

I have a collectionType page with a dynamic-zone content.
There are multiple (10+) components in content that sometimes also include (repeatable-)components.

I want to get all pages with all fields (for example: the component header in content with the fields: title and subTitle.)

v3-Implementation:

    const pages = await strapi.services.page.find(
      {
        _limit: -1,
        _sort: "updated_at:DESC",
      },
      []
    );

How is this done in v4?
All solutions I came across demand me to know what components are inside of content.
Also: Will I still need to include _limit: -1 for +300 (or so) entries?

Hope somebody can enlighten me.

Cheers,
Olaf

I guess I found a for me (for the moment) good enough solution.

v4-Implementation:

      const collectionType = 'api::page.page';
      const allPages = await strapi.entityService.findMany(collectionType, {
        fields: ["*"],
        filters: { },
        sort: { },
        populate: {
          // content [is the name of the dynamic zone in page]
          content: {
            populate: "*"
          },
        }
      });

In my v4-test-project I have multiple components (one with multiple string-attributes, one with an image, one with a relation…) in the dynamic zone of page.
For them the above implementation seems to work.

I hope this helps others. :slight_smile:

However if I want to include all fields of my relation (for example to another page with its own content dynamic zone) I need to adjust my implementation to:

...
        populate: {
          content: {
            populate: {
              // page [is the collectionType of the relation inside of the component in the dynamic zone in page]
              page: {
                populate: {
                  content: {
                    populate: "*"
                  }
                }
              }
            }
          }
        }
...

but then I’m missing the fields of the components in the dynamic zone of my page collectionType.
Is there a trick how I can achieve both?

Cheers,
Olaf