I have a database, like the screenshoot attached:
Under the Input there are many childs with 1,2,3,4... names. In my program I want to get the latest child, with the input1,2 and 3 values. Here is the code I have:
const databaseRef = firebase.database().ref();
const inputRef = databaseRef.child("Input");
inputRef.orderByChild("dataAdded").limitToLast(1).once('value', snap => {
console.log(snap.val());
});
And the output is:
{116: {…}}
116:
input1: 5
input2: 1
input3: 1
How can I put the input1,2 and 3 values into strings?
Aucun commentaire:
Enregistrer un commentaire