I'm trying to update a field from a snapshot, but even though the snapshot is not null and printed correctly, I can't seem to use ref.update()
on it. I tried to follow this answer. What am I missing here?
My code:
ref.limitToLast(1).on('child_added', function(snapshot) {
console.log(snapshot.val());
var serial_number = String(snapshot.child("serial").val()); //
console.log(serial_number);
snapshot.ref().update({ signed: 'true' });
// ...
}
Output: