saya mencoba mendaftar dan menyimpan info pengguna ke firestore. Operasi penyimpanan baik-baik saja tetapi saya ingin mencari info itu tetapi tidak ada yang terjadi. Ini kode saya
Mendaftar
firestore
.collection("users")
.doc(user.userId)
.collection("profile")
.add({ ...user })
.then(() => {
auth.onAuthStateChanged((u) => {
if (u) {
u.updateProfile({
displayName: user.displayName,
});
}
});
});
Ambil Semua data pengguna
firestore
.collection("users")
.get()
.then(function (querySnapshot) {
querySnapshot.forEach(function (doc) {
//doc.data() is never undefined for query doc snapshots
console.log(doc.id, " => ", doc.data());
});
});