"-Kqpdfjp2Q9cAuqZHY5w" : {
"email" : "test@apple.com",
"gamerTag" : "ok"
},
"-Kqpdx7Xpwht-E1K4in0" : {
"email" : "Human@human.com",
"gamerTag" : "ok"
}
The question which I am trying to ask is if there is a way to search if the email is taken. I have tried several methods but they don't seem to work. Also if someone could explain what I did wrong, that would be helpful. I always want to learn from my mistakes
One Method:
goalRef.once('value', function(snapshot) {
if (snapshot.hasChild("test@apple.com")) {
alert('exists');
}else
{
alert('maybe');
}
});
Second Method:
let human = goalRef.orderByChild("email").equalTo("test@apple.com");
human.update({
"email": "mat@gmail.com"
})
The second method is to update but that isn't working either.
goalRef = firebase.database().ref('human');