ref = Database.database().reference()
let currentUserID = Auth.auth().currentUser?.uid
let userRef = ref.child("users").child(currentUserID!)
let userRefQuery = userRef.queryOrdered(byChild: "requests").queryEqual(toValue: "received")
userRefQuery.observeSingleEvent(of: .value, with: { (snapshot) in
if (snapshot.value is NSNull) {
print("no data found")
return
}
print("value:")
print(snapshot.value)
print("key:")
print(snapshot.key)
})
How can I get the userIDs of users under "requests" which has a value of "received". Because it might also be "sent". Currently, I am not getting any data!