Sequelize, convert entity to plain object

后端 未结 9 1221
说谎
说谎 2020-12-12 16:53

I\'m not very familiar with javascript, and stunning, because i can\'t add new property, to object, that fetched from database using ORM names Sequelize.js.

To avoid

9条回答
  •  余生分开走
    2020-12-12 17:27

    you can use map function. this is worked for me.

    db.Sensors
        .findAll({
            where: { nodeid: node.nodeid }
         })
        .map(el => el.get({ plain: true }))
        .then((rows)=>{
            response.json( rows )
         });
    

提交回复
热议问题