How to make a querie from a plguin

I’m trying to make
await strapi.query(‘follower-following’, ‘application’).create({




from a plugin, but it throws this error

The model follower-following can’t be found.

What am I missing?

I think your model should be written as plural:


Hi @sunnyson! thanks for the reply!
I don’t think is that I’m trying to make

     console.log(await strapi.query('publications', 'application').find())

from users-permissions plugin and it throws the same error

If i do this, it works :+1:
follower: user,
following: followingUser

How exactly you are trying to call user-permissions plugin model?

This means your model is created inside application and not inside the plugin…

It should be called like this:

strapi.query('model', 'plugin').action()

You can also hook into the ORM (Bookshelf/Mongoose) using the .model action

So something like strapi.query('user', 'users-permissions').model.someMethod

Note that if the model is in the root API folder, there is no plugin, so it’s just strapi.query('model').action()

If i call it like this:
Does not work

I think this image explains what I trying to do

Why are you specifying application:: in query?
Make a screenshot of the model that you are trying to query. With the folder structure

Looks like some v4 information got crossed here. Can you link to your project code stored somewhere like GitHub?

1 Like