Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

191
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda