drolegc
1
Hi!
I’m trying to make
await strapi.query(‘follower-following’, ‘application’).create({
follower: user.id,
following: followingUser.id
})
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:
strapi.query('follower-followings','application')
drolegc
3
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
drolegc
4
If i do this, it works 
strapi.query(‘application::follower-following.follower-following’).create({
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('follower-following')
strapi.query('model', 'plugin').action()
https://strapi.io/documentation/developer-docs/latest/concepts/queries.html#custom-queries
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()
drolegc
7
If i call it like this:
strapi.query(‘follower-following’)
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