I have a database structure like this
firebase.auth().onAuthStateChanged((user) => {
if (user) {
database = firebase.database();
var dbRef = firebase.database().ref().child('Agents').child(newarray[i]).orderByKey();
dbRef.on('value', newAgents, errData);
}
})
function newAgents(data) {
var container = document.getElementById("team");
container.innerHTML = '';
data.forEach(function(AgentSnap) { // loop over all jobs
console.log(AgentSnap.key);
var Agents = AgentSnap.val();
var AgentCard = `
<div class= "profilepics" id="${key}">
<figure ><img src=${Agents.profilepicurl}><figcaption>${Agents.Fname}</figcaption></figure>
</div>
`;
container.innerHTML += AgentCard;
})
}
but a console log of the firebase datasnapshot key shows this
how can I change the key from the child nodes to for example 19777873?