sequelize 获取查询结果(result)后, 如何在 result 上添加一个字段 ?

let result = await user.findOne({
    where: post
  })

const friends = await sequelize.query(
      `SElECT DISTINCT * FROM user WHERE id IN 
      (SELECT targetId FROM friends WHERE sourceId = "${result.id}")`
    )

// 下面这行代码,未成功    
result.list = friends[0]

阅读 8.7k
1 个回答

result.dataValues.xxx = xxx
推荐
result.setDataValue(xxx,xxx)

推荐问题
宣传栏