I set up two models in sequelize that have a many-to-many relationship. Sequelize created the join table correctly, but I'm not able to insert into it. I've been poring over this section of the docs: http://docs.sequelizejs.com/en/latest/docs/associations/#creating-with-associations but I can't get anything to work based on their examples. They don't have a many-to-many example, unfortunately.
Models Relationships :
db.user.hasMany(db.post, {through: "likes"});
db.post.belongsTo(db.user, {through: "likes"});
Post.findById(postId).then( (post) => {
try{
Post.setLikes({userId: 1, postId: 1});
}catch(e){
console.error(e);
}
});