FindOne (Strapi v3 vs v4) 🙄

  • Strapi Version: 4

Hello guys,

I’m currently migrating from Strapi v3 to v4. But there are already many differences.

for example, this worked fine with Strapi v3:

let res = await strapi.services.restaurant.findOne({ name: 'Mega Pizza' });

But how do I change this line to Strapi v4?
I’ve tried several, e.g. E.g.: the following line does not work.

let res = await strapi.service('api::restaurant.restaurant').findOne({ name: 'Mega Pizza' });

Who can give me a tip? :roll_eyes:

Thanks in advance! :heart: