How to query for administrators

System Information
  • Strapi Version: 3.5.4
  • Operating System: OSX
  • Database: Mongo
  • Node Version: 14.11.0
  • NPM Version: 6.14.8

I want to query the administrators. Something like: strapi.query(‘strapi_administrator’).find…

No doubt this is easy but I’ve tried everything sensible I can think of…

strapi.query('user', 'admin').find() The strapi-admin package is treated as a plugin internally so the query functions in the same way as if you were trying to find users from the users-permissions plugin.

eg: strapi.query('user', 'users-permissions').find()

2 Likes

Hi there, it seems like this answer is outdate. Is there any new solution?
I tried something like this, but no success

const user = await strapi.db.query('plugin::admin.user').findMany({})`

got it, it’s simple ‘admin::user’ instead of ‘plugin::admin.user’