How to get user_id from nested parent firebase

Viewed 346

I want to retrieve sites information based on user_id , I am using following query to retrieve site information

ref = Database.database().reference()

        self.ref.child("sites").queryOrdered(byChild: "user_id").queryEqual(toValue:"DxMYXkVqnZMC6NEZxdSQF3G2ZJ53")
            .observe(.childAdded, with: { snapshot in

                if ( snapshot.value is NSNull ) {
                    print("Not found")


                } else {
                    print("found")


                }
            })

I am able to call query if its store_name,idToken etc . But not able to call user_id because its inside a childbuAutoid

enter image description here

3 Answers
Related