Reputation: 4271
I am trying to query this database:
I am using this line of code:
databaseReference.child("users").queryOrdered(byChild: "username").queryEqual(toValue: "billsmith").observeSingleEvent(of: .value, with: { (snap) in
print(snap)
})
This line of code returns null - meaning it did not find "jondoe" as a username in the users node. How do I get this to work?
Upvotes: 0
Views: 66
Reputation: 598728
Two problems:
usernames
vs username
This should work better:
databaseReference
.queryOrdered(byChild: "userDetails/username")
.queryEqual(toValue: "billsmith")
.observeSingleEvent(of: .value, with: { (snap) in
print(snap)
})
Upvotes: 1