query find sequelize code example
Example 1: sequelize find one
const project = await Project.findOne({ where: { title: 'My Title' } });
if (project === null) {
console.log('Not found!');
} else {
console.log(project instanceof Project);
console.log(project.title);
}
Example 2: sequelize query result
sequelize.query("UPDATE users SET y = 42 WHERE x = 12").spread(function(results,
metadata) {
})
sequelize.query("SELECT * FROM `users`", { type: sequelize.QueryTypes.SELECT})
.then(function(users) {
})