firebase.firestore().collection("attendance") 在 firestore 数据库中返回 0 结果

Usa*_*hir 5 javascript node.js firebase google-cloud-firestore

[问题已更新]

节点.js 代码

const updateLoggedMeetings = function () {
  return new Promise((res, rej) => {
    let query = store.collection("attendance");
    query.get()
    .then(data => {
      console.log("DATA is  ", data._size);
      }).catch(err => console.log("SOME ERROR OCCURED IN THEN BLOCK ",err));
    res(`blah`);
   })
 }
Run Code Online (Sandbox Code Playgroud)

并输出截图 输出

我的数据库结构是:

1:考勤采集 考勤收集

2:会议集合 会议集合

我的数据库查询是: firebase.firestore().collection("attendance") 当我运行此查询时,它返回零结果。但是,当我运行时firebase.firestore().collection("meetings"),它会返回一些结果。我想要实现的是检索attendance集合中所有文档的文档名称。谢谢

har*_*iya 0

由于考勤又嵌套了集合所以不会返回文档。您可以参考这篇文章以更好地理解。你可以这样使用

var attendance = 
db.collection('attendance').doc('doc_id') and you will get the logged_meeting
Run Code Online (Sandbox Code Playgroud)

https://firebase.google.com/docs/firestore/data-model