HasMany 关联错误 "raw" 和 "nest" 为真

HasMany association coming wrong with "raw" and "nest" as true

可能是sequelize的bug,我刚刚在那里开了个issue。

click here to see the code

我想 raw 选项使 Sequelize 到 return 普通查询结果而不对它们进行分组(这就是它被称为“原始”的原因)。因此,这意味着如果每个主记录都有两个子记录,那么您最终会得到 N*2 个由 Sequelize 编辑的对象 return。
如果您希望获得普通对象而不是 Sequelize 模型实例,只需为每个模型实例调用 get({ plain: true})

const cart = await Cart.findOne({
...
})
const plainCart = cart.get({ plain: true})