How to get only the dataValues from Sequelize ORM?

Sometimes, we want to get only the dataValues from Sequelize ORM.

In this article, we’ll look at how to get only the dataValues from Sequelize ORM.

How to get only the dataValues from Sequelize ORM?

To get only the dataValues from Sequelize ORM, we can set the raw option to true.

For instance, we write

Model.findAll({
  raw: true,
  //...
});

to call findAll with an object with the raw property set to true to only return the dataValues in the query results.

Conclusion

To get only the dataValues from Sequelize ORM, we can set the raw option to true.