swift - Firebase snapshot.key not returning actual key? -
i have query searches user based on user id.
usersref.queryorderedbychild("email").queryequaltovalue(email).observeeventtype(.value, withblock: { snapshot in     if snapshot.exists() {         print("user exists")         print(snapshot.key) the query returns correct user, line print(snapshot.key) literally returns word "users", , not actual user id. print(snapshot) returns following user:
snap (users) {    delyncz9zmttbikfbnyxtbhuadd2 =     {        email = "test3@gmail.com";        "first_name" = test;        "last_name" = test;    }; how can delyncz9zmttbikfbnyxtbhuadd2? can email using let email = child.value["email"] can't key because it's not named attribute.
thanks!!
edit: updated code frank's answer. getting ambiguous use of key
query.observeeventtype(.value, withblock: { snapshot in             print(snapshot.key)              if snapshot.exists() {                 print("user exists")                  child in snapshot.children {                     print(child.key) 
when run query @ location, result list of matching children. if there single matching item, result list of 1 child.
you're printing key of resulting children. since there no single result, sdk prints key of location/collection queried: users.
what you're looking loop on matching children , print keys:
let query = usersref.queryorderedbychild("email").queryequaltovalue(email) query.observeeventtype(.value, withblock: { snapshot in     child in snapshot.children {         print(child.key)     } })