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

224
Vistas
Get Firebase child value in JavaScript

I want to only get a specific child value from Firebase using JavaScript. I always get the entire child values.

This is what it looks like:

Child a -
        |- fcmToken: 'abcdefg'

Child a -
        |- fcmToken: 'hijklmn'

I always get the entire thing. "Child a – fcmToken: 'abcdefg'" But I only want to get the fcmToken value 'abcdefg' and 'hijklmn'

Ho can I do so?

I tried this:

return admin.database().ref('/fcmToken').once('value', snapshot => {

var uid = snapshot.val();

return admin.database().ref('/fcmToken/' + uid).once('value', snapshot => {

  var fcmToken = snapshot.val();
  console.log('FCMTOKEN:', fcmToken)

});

But it's not working. Any ideas, how I can only get the desired values 'abcdefg' and 'hijklmn'

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

After days of trying I have finally found a solution! Here is what I did:

return admin.database().ref('/fcmToken').once('child_added', snapshot => {

var uid = snapshot.key;

return admin.database().ref('/fcmToken/' + uid + '/fcmToken').once('value', snapshot => {

  var fcmToken = snapshot.val();

});

The var fcmToken = snapshot.val(); was the data, I needed and was trying to get.

about 4 years ago · Juan Pablo Isaza Denunciar
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