Moving from v3 to v4: default find-Services

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