续集中有多个删除可用吗?
我有一个多个contentIds。
Mode.findAll({ where: { id: contentIds } })
find全部后,如何从表中删除多行。
或者告诉我其他选项,用一个查询删除多个logging。
问题与您的问题
文档
例:
Mode.destroy({ where: { id: [1,2,3,4] }})
如果要删除特定types的所有型号,可以使用:
Model.destroy({where: {}}).then(function () {});
这将从数据库中删除“Model”types的所有logging。 用mysqltesting过;
使用销毁方法http://sequelize.readthedocs.org/en/latest/docs/instances/#destroying-deleting-persistent-instances
Mode.destroy({ where: { id: contentIds } })
销毁模型中的所有条目:
Model.destroy({ where: {} }).then(function(){ console.log('destroy all data'); res.redirect('/'); })