Last modified: Thu Nov 07 2019 22:08:12 GMT+0000 (Coordinated Universal Time)

Sequelize Read/Fetch API

FindAll

Blog.findAll({
    include: [User, Category],
    orderBy: [['id', 'DESC']],
})
    .then(res => console.log(JSON.stringify(res, undefined, 4)))
    .catch(e => console.log(e))

FindOne

User.findOne({
    where: { id: 4 },
    include: [Blog],
})
    .then(res => console.log(JSON.stringify(res, undefined, 4)))
    .catch(e => console.log(e))

Contributors

kingRayhan

results matching ""

    No results matching ""