So I'm trying to increment data for sending a num to other user's num.
const sendNum = async(e) => {
e.preventDefault();
const targetQuery = query(userCol, where("keycode", "==", parseInt(target)));
const targetSnapshot = await getDocs(targetQuery)
targetSnapshot.forEach((document) => {
console.log(document.data().num)
console.log(document.id)
const targetRef = doc(db, 'users', document.id)
setDoc(targetRef, {
num: // increment user data here
}, {merge: true})
})
}
But a documentation that I found, I don't really understand them. And the one I understand, it's already outdated. So I would be very happy if anyone know how :)