【问题标题】:how to find three tables data using sequelize?如何使用sequelize查找三个表数据?
【发布时间】:2018-11-30 10:33:50
【问题描述】:

表格:

表格关联:

 //category_product with category
category.hasMany(category_product,{foreignKey:'category_id'})
category_product.belongsTo(category,{foreignKey:'category_id'})

//category_product with Product
Product.hasMany(category_product,{foreignKey:'product_id'})
category_product.belongsTo(Product, {foreignKey: 'product_id'})

Git bash 错误

throw new Error(this.name + '.hasMany called with something that\'s not asubclass of Sequelize.Model');
  ^

Error: Theme.hasMany called with something that's not a subclass of Sequelize.Model

谢谢!

【问题讨论】:

标签: mysql sequelize.js


【解决方案1】:

我已经解决了这个问题。

这是我的方式mini-shop

【讨论】:

    猜你喜欢
    • 2018-12-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-15
    • 1970-01-01
    相关资源
    最近更新 更多