代码之家  ›  专栏  ›  技术社区  ›  Amine Harbaoui

获取子集合数据

  •  1
  • Amine Harbaoui  · 技术社区  · 6 年前

    这是我第一次使用firestore,所以我试图获取子集合的数据:

    enter image description here

    enter image description here

    我的密码是:

    db.collection("pointage").get().then((querySnapshot) => {
        console.log(1);
        querySnapshot.forEach((document) => {
            console.log(2);
            document.ref.collection("listStudents").get().then((querySnapshot) => {
                console.log(3);
                querySnapshot.forEach((result) => {
                    console.log(4);
                });
            }).catch(function (error) {
                console.log("Error getting document:", error);
            });
        });
    }).catch(function (error) {
        console.log("Error getting document:", error);
    });
    

    0 回复  |  直到 6 年前