in firebase if you use push , it generates a key. Now, if push several items there will be several keys. If each item has for example name as a property. lets say I push name: john twice. Now I will have two unique keys but both will contain name: john.
playersRef.push({
name: "john"
interest: "hockey",
});
everything I have read says you can access the data using something like below, but i want to access it by the individual key so I know I access the correct “john”, any suggestions?
playersRef.on("value", function (snapshot) {
snapshot.forEach(function (childSnapshot) {
let data = childSnapshot.val().name;
if ((data = "john")) {
console.log(data);
}
});
});