How do I query in many to many relationships? eg There are product, category, and product_category models. Below is an association by model:
// product
product.belongsToMany (models.category, {
through: 'product_category',
foreignKey: 'product_id'
});
// category
category.belongsToMany (models.product, {
through: 'product_category',
foreignKey: 'category_id'
});
// product_category
product_category.belongsTo (models.product, {
foreignKey: 'product_id'
});
product_category.belongsTo (models.category, {
foreignKey: 'category_id'
});
I would appreciate if you can tell me which model the findAll ()
should have at the beginning when querying.
是的,如果你正在使用节点和续集它似乎是一个很好的契合,这是一个非常简单的提升,使GraphQL在你的解析器中运行和操纵你的续集模型...很高兴有graphiql游乐场用你的查询....容易豌豆
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.