I’m new to Firebase but I understand how it might works but I’m stuck with this for too long and I can’t find any doc about it.
I want to update a user from “wallet” field (I don’t know his id) and add token with the new amount, so I get the user, the I get again the user to update the data
const userCollec = await admin.firestore().collection('users').where('wallet', '==', req.data.sender).get();
const UserToken = userCollec.get('token')
const UserUsd = userCollec.get('usd')
admin.firestore().collection('users').where('wallet', '==', req.data.sender).update({
"token" : UserToken + Math.round(amount / 0.07),
"usd" : UserUsd + amount
})
for me this should work but I don’t why it doesn’t and I have absolutly no idea.