我试图将 hasOne 关联包含在 findAll 方法中,如下所示

await db.Symbol.findAll({
    where:{
        symbol: symbols
    },
    attributes: ['symbol'],
    include: [{
        as: 'price',
        model: db.Price,
        attributes: ['adjClose', 'createdAt']
    }]
});

但是我得到了错误的结果,因为sequelize给我的结果如下 .

{ 
  symbol: 'SNAP',
  price: { adjClose: 22.07, createdAt: 2017-03-10T00:00:00.000Z } 
},
{ 
  symbol: 'SNAP',
  price: { adjClose: 22.709999, createdAt: 2017-03-09T00:00:00.000Z } 
}

但我只需要一个对象,因为我已经将我的hasOne关联包含为 price 并且包含了''t need duplicated values of my '符号'对象 .

我的 hasOne 关联看起来像这样

Symbol.hasOne(models.Price,{
    as: "price",
    foreignKey:"companyId"
});

有没有办法只选择一个带有包含的项目?我只是限制子查询,我想这可以帮助,但据我所知,不幸的是sequelize不支持它 .

希望可以有人帮帮我 . 提前致谢!