如何获取嵌套文档:collection(“ logs”)-> doc(“ email.com”)-> collection(“ date”)-> doc(“ time”))

时间:2019-07-31 09:48:42

标签: angular google-cloud-firestore

我在集合(“日志”)里面的其他文档(“电子邮件”)里面有“日志(时间)”文档,我如何提取单个日志对象 从这种结构?

它对我有用的唯一方法是硬编码特定文档的完整路径:

getLogs(email : string)
 {
    this.db.firestore.collection("logs")
   .doc(email)
   .collection("30-7-2019")
   .doc("10:29:41")
   .get()
   .then(res =>{console.log(res);});   
 }

当然,问题在于我无法提供特定的日期和时间,而只能提供电子邮件,并且当我尝试通过“ logs / some_email”进行访问时,其返回的空数组为:

getLogs(email : string)
{
   this.db.firestore.collection("logs")
  .doc(email)
  .get()
  .then((res) => console.log(res));   
}

任何建议(:?

0 个答案:

没有答案