Find or create with SequelizeJS
I had the same problem. Upgrading from 1.7.0-alpha2 to 2.0.0-alpha2 solved it. Cheers
For me the answer was changing my promise resolver from .then to a .spread. This has something to do with the format that Sequelize returns data.
for( var i = 0; i < tags.length; i++ ){
global.db.Tag.findOrCreate({
name: tags[i]
}).spread( function(tag, created){
if( created ){
global.db.PostTag.create({
PostId: id,
TagId: tag.id
});
}
});
}