"-Kqpdfjp2Q9cAuqZHY5w" : {
"email" : "[email protected]",
"gamerTag" : "ok"
},
"-Kqpdx7Xpwht-E1K4in0" : {
"email" : "[email protected]",
"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("[email protected]")) {
alert('exists');
}else
{
alert('maybe');
}
});
Second Method:
let human = goalRef.orderByChild("email").equalTo("[email protected]");
human.update({
"email": "[email protected]"
})
The second method is to update but that isn't working either.
goalRef = firebase.database().ref('human');