【问题标题】:Can we make dynamic document in firestore using angular?我们可以使用 Angular 在 Firestore 中制作动态文档吗?
【发布时间】:2020-04-12 08:19:19
【问题描述】:

我希望包含动态 ID 的 doc("") 来获取该动态文档的值。如果我在同一个集合下有两个名为 document1 和 document2 的文档,那么我该如何给出具有动态 documentName 的动态路径来获取我想要的特定文档的值?

 this.items = db.collection("First").doc("dynamicId").collection("Second").valueChanges();

【问题讨论】:

    标签: javascript angular firebase google-cloud-firestore


    【解决方案1】:

    您可以使用变量来使文档动态化,如下所示:

    var collection = "First";
    var document = "document1";
    this.items = db.collection(collection).doc(document);
    

    【讨论】:

      猜你喜欢
      • 2019-10-23
      • 1970-01-01
      • 1970-01-01
      • 2021-09-15
      • 1970-01-01
      • 2018-06-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多