mercredi 4 mai 2016

Firebase TypeError: childSnapshot.child(...).set is not a function

I have a node file that reads data for each child in Firebase.

On each child, I want to set the value of a specific child, but I receive a TypeError that "set" is not a function.

I can access the value of that child, and print it's key, but am not sure why I can not call set.

Here is a snapshot of my code:

myFirebaseRef.once("value", function(snapshot) {
  snapshot.child("Locations").forEach(function(childSnapshot) {
    var startTime = childSnapshot.child("Start Time").val();
    var endTime = childSnapshot.child("End Time").val();
    var currentTime = getTimeStr();

    if(startTime == currentTime) {
      console.log("inside start time");
      childSnapshot.childSnapshotd("Is Available").set('True');
    }

    if(endTime == currentTime) {
      console.log("inside end time");
      childSnapshot.child("Is Available").set('False');
    }
  });
});     




Aucun commentaire:

Enregistrer un commentaire