I am trying to figure out how to update an existing document for the same user ID in V9 Firebase whenever they log in, rather than creating a new one each time. Any suggestions on how to achieve this?
Current Code
setDoc(
query(collectionRef),
// db.collection('users').doc(user.uid).set(
{
email: user.email,
lastSeen: serverTimestamp(),
photoURL: user.photoURL
}, {
merge: true
}
);
Past Code that referenced document UID: