在 Sequelize 的 JSON 字段上使用 select

Using select on JSON field in Sequeilze

我想查找一些项目,但 return 只有 JSON 字段 (body) 中的一个字段 (name)。如果重要的话,JSON 字段也在关联 (Version) 中。

想象会是这样的。

Part.findAll({
  attributes: ['slug'],
  include : [{
    model: Version,
    limit: 1,
    order: [['createdAt', 'DESC']],
    attributes: ['body.name']
  }]
})

我想写评论,但我不能,因为我没有足够的声誉。所以你不能只检索正文并从结果中获取 JSON.

所需的属性吗?