续集和嵌套结果?

Sequelize允许数据关系,但我似乎无法看到是否有办法让它返回由关系组成的查询结果? 我可以做这两个查询,但我很好奇Sequelize是否提供这个? 例如播放列表和播放列表条目:

Playlist: sequelize.define('playlist', { name: Sequelize.STRING, description: Sequelize.STRING }), PlaylistEntry: sequelize.define('playlist_entry', { playlist: Sequelize.INTEGER //track: Sequelize.INTEGER }) PlaylistEntry.belongsTo( Playlist, { as: 'Playlist', foreignKey: { name: 'fk_playlist' }}); 

我会希望的(伪代码):

查询:

 Playlist.find(where: {id: playlistId}, nestedResult: true); 

结果:

 [{ id: 123, name: 'abc' playlistEntries: [{ id: 321, track: 431 }] }] 

  • 快速模块function中的查询
  • Postgres方言不工作在续集-m
  • sequelize有没有更改跟踪内置机制?
  • 如何在Sequelize Js中使用Promise来返回实体
  • beforeUpdate似乎没有被调用
  • 没有列'id'的sequelize表
  • 节点的Sequelize不允许在主键上自动生成UUID *除非*字段名称是'id'
  • 如何使用Sequelize for node.js和Heroku Postgres脚本同步和迁移操作?
  •  Playlist.find({ where: {}, include: [ {model: PlaylistEntry} //this should be PlaylistEntry model ] }) 

    http://docs.sequelizejs.com/en/latest/docs/models-usage/#eager-loading