I'm not good in firebase, but I'm making one project regrading chat app. i have created one not node GroupChat inside that i create group with including members. now i want to check that if userid is available in subchild node like UserInfo/userid . You can get esaily idea by watching below structure . AnyHelp can be appreciate.
Here is my coding for retrive data for specific value.
let questionPostsRef = Database.database().reference().child("GroupChat")
let query = questionPostsRef.queryOrdered(byChild: "UserInfo/userid").queryEqual(toValue: FireStoreApp.shared.objUser.strUserID)// Here i pass userid that i want to check in firebase.
query.observeSingleEvent(of: .childAdded, with: { snapshot in
print(snapshot.value)
if !snapshot.exists() { return }
for child in snapshot.children {
let childSnap = child as! DataSnapshot
let dict = childSnap.value as! [String: Any]
print(dict)
}
})
Thank you in advance for your valuable time