Sequelize, convert entity to plain object

you can use the query options {raw: true} to return the raw result. Your query should like follows: db.Sensors.findAll({ where: { nodeid: node.nodeid }, raw: true, }) also if you have associations with include that gets flattened. So, we can use another parameter nest:true db.Sensors.findAll({ where: { nodeid: node.nodeid }, raw: true, nest: true, })

Sequelize.js: how to use migrations and sync

Generating the “first migration” In your case, the most reliable way is to do it almost manually. I would suggest to use sequelize-cli tool. The syntax is rather plain: sequelize init … sequelize model:create –name User –attributes first_name:string,last_name:string,bio:text This will create both model AND migration. Then, manually merge your existing models with generated with sequelize-cli, … Read more

How to update a record using sequelize for node?

Since version 2.0.0 you need to wrap your where clause in a where property: Project.update( { title: ‘a very different title now’ }, { where: { _id: 1 } } ) .success(result => handleResult(result) ) .error(err => handleError(err) ) Update 2016-03-09 The latest version actually doesn’t use success and error anymore but instead uses then-able … Read more

tech