我正在尝试从文档中检索数组,但是该文档在异步.then函数中返回undefined
除此呼叫外,所有其他呼叫均正常工作。收到的确切错误代码是
无法在process._tickDomainCallback(internal / process / next_tick.js:229:7)的/srv/routes/raffles.js:54:37读取未定义的属性“电子邮件”
这是我的相关代码:
var array = await doc.data().email;
await array.forEach(async function (value) {
if (value == email) {
} else {
checkedScore++
}
});
});```
Doc returns as undefined even though I am not changing anything from my last requests. As you can see from my database, all names and paths are correct. http://prntscr.com/ogly3n
答案 0 :(得分:0)
尝试一下:
let document = await db.collection("raffles).doc("h5s3a").get();
let array= document.data().email;
for (let element of array) {
if (element == email){
//do something
}else{
checkedScore++
}
}