admin管理员组文章数量:1208155
I'm trying to get some rows from database that are soft deleted AND some that are not, but it's not working for me.
Model.findAll({
'where': {
cond: 'xxx'
},
include: [Model2],
paranoid: false
}).then(function (rows) {
// do something
}).catch(function (err) {
// do something
});
How can I do it?
I'm trying to get some rows from database that are soft deleted AND some that are not, but it's not working for me.
Model.findAll({
'where': {
cond: 'xxx'
},
include: [Model2],
paranoid: false
}).then(function (rows) {
// do something
}).catch(function (err) {
// do something
});
How can I do it?
Share Improve this question asked Sep 18, 2015 at 19:04 kecal909kecal909 1631 gold badge2 silver badges10 bronze badges1 Answer
Reset to default 23The query you have should include instances of Model
that have been soft-deleted, but won't include instances of Model2
that are soft-deleted.
To get the soft-deleted Model2
instances, you'll also need the paranoid: false
option within the include
:
Model.findAll({
'where': {
cond: 'xxx'
},
include: [{
model: Model2,
paranoid: false
}],
paranoid: false
}).then(function (rows) {
// do something
}).catch(function (err) {
// do something
});
This doesn't seem to be in the documentation, but I tried it and it worked.
本文标签: javascriptSequelize find soft deleted rowsStack Overflow
版权声明:本文标题:javascript - Sequelize find soft deleted rows - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738682236a2106621.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论