序列化belongsToMany关联addProduct不是一个函数

时间:2019-02-07 10:38:46

标签: javascript node.js sequelize.js

我找不到以(getProduct, setProduct ...)加上sequelize的函数

// this is my models 
const Product = sequelize.define('product', {...});
const Transaction = sequelize.define('paiement', {...});

// and here i make the association 
Product.belongsToMany(Transaction, {through: TransactProduct});
Transaction.belongsToMany(Product, {through: TransactProduct});

然后,当我尝试以addProduct的形式到达函数时,它显示出不是函数的错误

Transaction.create({...}).then( transact => { transact.getProducts().then().catch)

关联的配置有问题,我不明白为什么它不能将功能识别为addProductgetProduct ...

0 个答案:

没有答案