136
rated 0 times
[
139]
[
3]
/ answers: 1 / hits: 30093
/ 8 Years ago, sun, july 17, 2016, 12:00:00
I am trying to add a property to a sequelize instance before passing it back to the client.
router.get('/cats/1', function (req, res) {
Cat.findOne({where: {id: 1}})
.then(function (cat) {
// cat exists and looks like {id: 1}
cat.name = Lincoln;
// console.log of cat is {id: 1, name: Lincoln}
res.json(cat);
});
});
The client only see's {id: 1}
and not the newly added key.
- What is going on here?
- What type of Object is returned by Sequelize?
- How can I add new properties to my Cats and send them back?
More From » postgresql