I want to change the mail in my account, I want that in all collections where SendTO =
current mail the value changed to new mail (userEmail
)
I can get the collections I need, but how can I replace my old mail (SendTo
field) with a new one?
// data.email new email
// userEmail currently email
await user.updateEmail(data.email);
await firestore.collection("Mission")
.where("SendTo", "==", userEmail)
.get()
.then(snap => {
let datas = snap.docs.map(doc => doc.data());
datas.map(p => firestore.collection("Mission").doc(p.idOwner).update({
SendTo: data.email
}))
});
await firebase.auth().signOut();