[英]Sequelize - Promise.All returning array of undefined
以下查询成功注销了查询的结果:
loans.findAll({
attributes: option.LoanAttributes,
include: option.LoanIncludes
}).then(results => {
console.log(ExtractQuery(results));
});
但是,当我将其包装在promise.all
函数中时,它将返回未定义的数组:
Promise.all([
loans.findAll({
attributes: option.LoanAttributes,
include: option.LoanIncludes
})
]).then(results => {
console.log(ExtractQuery(results));
})
Promise.all(promiseArraySizeN).then(fulfilledPromiseArraySizeN)
您有一个大小为1的promise数组,因此它将返回一个大小为1的已实现的promise数组。因此,您需要检查result [0]。
Promise.all([
loans.findAll({
attributes: option.LoanAttributes,
include: option.LoanIncludes
})
]).then(results => {
console.log(ExtractQuery(results[0]))
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.