How to use entityService for user

In Controller, I am trying to fetch users by

let isUserExist = await strapi.entityService.findMany("api::users.users");

But getting error

TypeError: Cannot destructure property 'kind' of 'strapi.getModel(...)' as it is undefined.

Users is found in a plugin thats why it fails, try this

    const user = await strapi.entityService.findOne(
      "plugin::users-permissions.user",
      ctx.state.user.id,
      {
        populate: [
          "role"
        ],
      }
    );```
2 Likes