Sequelize js 'include' and 'raw'
as you see, raw has some problems with joins (there is an issue) try just use instance method #toJSON
entities.Chest.findAll({include:[{model: entities.User}]})
.then(function(chestsSeq){
var chests = chestsSeq.toJSON(); //same as chestsSeq.get({});
//do something with raw chests object
});
This syntax helps for me. You haven't to iterate your records. Just use nest: true
and raw: true
in pairs;
entities.Chest.findAll({
raw:true,
nest: true,
include:[entities.User]
})