moleculer-db icon indicating copy to clipboard operation
moleculer-db copied to clipboard

bulk update?

Open olivinesguerra opened this issue 4 years ago • 2 comments

any idea on bulk updating?

this.adapter.updateMany({ parent_id: { [Op.and]: user.id }}, {$set: { is_feature: false }})

this seems to be not working.

Thanks

olivinesguerra avatar Sep 03 '19 10:09 olivinesguerra

https://sequelize.org/master/manual/instances.html#working-in-bulk--creating--updating-and-destroying-multiple-rows-at-once-

intech avatar Oct 11 '19 09:10 intech

@olivinesguerra try this => this.adapter.db.models.MODELNAME.update({ field1:'value1' , field2:'value2' },{where:{condition here}})

deepdil-sp avatar Nov 08 '19 05:11 deepdil-sp