以下查询成功注销查询结果:
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));
})
答案 0 :(得分:4)
Promise.all(promiseArraySizeN).then(fulfilledPromiseArraySizeN)
你有一个大小为1的promise数组,因此它将返回一个大小为1的履行的promise数组。因此你需要检查结果[0]。
Promise.all([
loans.findAll({
attributes: option.LoanAttributes,
include: option.LoanIncludes
})
]).then(results => {
console.log(ExtractQuery(results[0]))
})