I know im asking too many stupid question but please help me out if possible, so i am using this code to send data to firebase:
try {
const docRef = await addDoc(collection(db, "users"), {
owner_uid: authUser.user.uid,
username: username,
email: authUser.user.email,
profile_pic: await randomProfiles()
});
console.log("CREATED");
this.props.phase(0);
} catch (e) {
console.log(e);
}
} catch (error) {
console.log(error);
}
};
I cannot figure out how to set the doc id using this code. it was written by a friend. I read the documentation of firebase but i cant figure out how to implement this in to my code :
db.collection("users")
.doc(authUser.user.email)({
owner_uid: authUser.user.uid,
username: username,
email: authUser.user.email
})