I have two tables in postgresql in strapi: goods and labels
Goods:
id | title
---------
1 | some name
2 | some name 2
3 | some name 4
…………………
Labels
id | title
------------
1 | some label 1
2 | some label 2
3 | some label n
………………………
They are connected with each other many to many, through an additional table
goods_labels__labels_goods
id | good_id | label_id
----------------------------
1 | 1 | 1
2 | 1 | 2
2 | 2 | 1
I need to select goods that have a relationship with both label.id = 1 and label.id = 2, this is only the first product with id = 1. Is any way to implement it with standart strapi tools with graphql or with bookshelf, or as a last resort through a raw query? Also I need to sort and limit this request
ok. the content is here.
I have two content-type in strapi like tag and article. And want to filter articles which both have several tags like 1,2,4. In the standard strapi, you cannot do this .so I have to change the default behavior of strapi article api. you can find the document in here
first
we need to define the special parameter to reach our goals. in fact I choose the multiTag in the query parameter
second
open file in your project
/src/api/article/controllers/article.js
! notice: the path would change with your content-type name.
you should get this
then add some code to this