【问题标题】:Call to firestore database returning undefined调用 Firestore 数据库返回未定义
【发布时间】:2019-07-18 05:24:07
【问题描述】:

我正在尝试从文档中检索一个数组,但是该文档在异步 .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

【问题讨论】:

    标签: firebase google-cloud-firestore nosql


    【解决方案1】:

    试试这个:

    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++
                }
            }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-20
      • 2022-01-19
      • 2021-11-22
      • 2017-10-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多