javascript - Sequelize update does not work anymore: "Missing where attribute in the options parameter passed to update" -
javascript - Sequelize update does not work anymore: "Missing where attribute in the options parameter passed to update" -
the official api documentation suggests using model.update
this:
var gid = ...; var uid = ...; var values = { gid: gid }; var = { uid: uid }; mymodel.update(values, where) .then(function() { // update callback });
but gives me: "missing attribute in options parameter passed update". docs mention usage deprecated. seeing error makes me think, changed it. doing wrong?
apparently, docs have not been updated yet. table's where
row of the model.update
api docs suggests prefixing selection where
, so:
var gid = ...; var uid = ...; var values = { gid: gid }; var selector = { where: { uid: uid } }; mymodel.update(values, selector) .then(function() { // update callback });
and works!
update:
the docs have since been updated (and docs have been moved). check out model.update on docs.sequelize.com. note options.where
not optional (it not in brackets []).
javascript node.js sequelize.js
Comments
Post a Comment