如果我有:
var Game = Sequelize.define('game');
var Move = Sequelize.define('move');
Move.belongsTo(Game);
如何通过所有动作获得一系列游戏?看来我可以通过游戏轻松获得所有动作:
Move.findAll({include: Game});
但不是相反?
Game.findAll({include: Move});
给我Unhandled rejection Error: Move (move) is not associated to game!
。
答案 0 :(得分:2)
您需要双向提供关联
Game.hasMany(Move);