Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

195
Views
Firebase how to use where and update JS

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.

    const userCollec = await admin.firestore().collection('users').where('wallet', '==', req.data.sender).get();

Those value should return something but they don't even tho the doc with the wallet and the value req.data.sender exist 100%.

    const UserToken = userCollec.get('token')
    const UserUsd = userCollec.get('usd')
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!