samedi 23 juin 2018

Can't retrieve values for a specific child with firebase

I am using firebase and I want to only retrieve childs with a specific value (activiteId) for a given key ("associationId")

What I tried:

firebase.database().ref().child("collectivites").child(collectiviteId).child("evenements").orderByChild("associationId").equalTo(activiteId).once("value", function (snapshotAssociationEvenements) {
  const data = snapshotAssociationEvenements.val();
  if (data){
   console.log(data);
  }
});

The problem : The child is displayed in the console but if I do console.log(snapshotAssociationEvenements.val().associationId); the console returns undefined

What have I done wrong ?

Thank you !




Aucun commentaire:

Enregistrer un commentaire