I am trying to use the unique id that firebase gives to get the data value from the child. I can get the data value from the child by hardcoding the unique id. But the database will have multiples stored and I want to get newest stored data.
I have tried to use the pushId but it makes the child come back null
function handler(agent){
const db = firebase.database();
// const numberParam = agent.parameters.checknumber;
const ref = db.ref('/cnumber/transaction/{pushId}/');
return ref.once('value')
.then((datashot) =>{
const number = datashot.child('cnumber').val();
agent.add('The number is' + number);
console.log(number);
});
}