I have such a structure in "/ users"
{
"aaa@aaa-com":{
"email":"aaa@aaa.com",
"name": "Joseph",
},
"asd@asd-com": {
"email": "asd@asd.com",
"name": "Erik"
}
}
I made a request for access to a child who has a letter " aaa@aaa.com ":
usersRef.queryOrderedByChild("email").queryEqualToValue("aaa@aaa.com") .observeEventType(.Value, withBlock: { snapshot in
if snapshot.exists() {
print("user exists")
} else if !snapshot.exists(){
print("user doesn't exists")
}
If I print (snapshot), I get console output in xcode:
Snap (users) {
"aaa@aaa-com" = {
email = "aaa@aaa.com";
name = "Joseph";
};
}
I am trying to find a way to get the username after executing this request, but I have not found a way to do this. I tried:
print(snapshot.value.objectForKey("name"))
print(snapshot.value.valueForKey("name"))
but I get zero in both.
Do you know how to get the name value?
Thanks in advance!
Ruben source
share