How to use fields in populate of sub category

Here is an example of how I have done this.

    let restaurants = await strapi.entityService.findMany(
      "api::restaurants.restaurant",
      {
        fields: ["ordinal", "feature_type", "width"],
        populate: {
          restaurant: {
            fields: ["title"],
            populate: ["lead_image"],
            populate: {
              tags: { fields: ["tag"] },
              room_types: { fields: ["price", "start_date"] },
              lead_image: {
                fields: ["alternativeText", "width", "height", "formats"],
              },
            },
          },
        },
        sort: ["feature_type", "ordinal"],
      }
    );

1 Like