Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

199
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda