使用UUID错误为NodeJS重新加载并hasMany

我有一个模型'匹配'有很多'MatchRoundTypes'

匹配具有uuid的主键matchRoundTypes引用matchUUID作为其列名匹配。

当我尝试在包含MatchRoundTypes的匹配上进行查找时,我得到:

debugging:错误:MatchRoundTypes不匹配匹配!

我的查询如下所示:

Matches.findAll({where: ["isPublished = ?", true], include: [MatchRoundTypes]}) 

在这之前我已经发布了以下命令:

 Matches.hasMany(MatchRoundTypes, { as: 'roundMaps', foreignKey: 'matchUUID', useJunctionTable: false}) 

我已经尝试了hasMany声明中的许多变体…包括foreignKey而不是等等。

这是我的匹配模型:

 sequelize.define('Matches', { uuid: {type: Seq.STRING(36), allowNull: false, primaryKey: true}, name: {type: Seq.STRING(64), allowNull: false}, }, {tableName: 'match', freezeTableName: true}) 

这是我的MatchRoundTypes模型:

 sequelize.define('MatchRoundTypes', { { uuid: {type: Seq.STRING(36), allowNull: false, primaryKey: true}, roundTypeUUID: {type: Seq.STRING(36), allowNull: false}, roundName: {type: Seq.STRING(64), allowNull: true}, matchUUID: { type: Seq.STRING(36), references: "match", referencesKey: "uuid", allowNull: false } }, {tableName: 'matchRoundTypes', freezeTableName: true}) 

任何见解都是最受欢迎的。

定义hasMany关联时使用的是别名,因此在执行加载时还必须告诉sequelize使用该别名:

 Matches.findAll({ where: ["isPublished = ?", true], include: [{ model: MatchRoundTypes, as: 'roundMaps' }] })