Categories
JavaScript Answers

How to get only the dataValues from Sequelize ORM?

Spread the love

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.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *