0

I am trying to query Firebase database using the below method to obtain all the userId's, whose registration status is approved, but I am unable to.

Could someone please suggest/guide me how I could do this ?

var registeredUsersRef = firebaseDB.ref("users/registered/");
registeredUsersRef.orderByChild("registrationData").orderByChild("registrationStatus").equalTo("approved").once('value', snapshot => {

}

Below is my Sample Data Structure

{
  "users" : 
      {
        "registered" : 
          {
            "userId1" : {
                "registrationData" : {
                  "registrationStatus" : "approved",
                  "experience" : "10 yrs",
                  "firstName" : "Peter",
                }
            },
            "userId2" : {
                "registrationData" : {
                  "registrationStatus" : "notApproved",
                  "experience" : "7 yrs",
                  "firstName" : "Simon",
                }
            },
            "userId3" : {
                "registrationData" : {
                  "registrationStatus" : "awaitingApproval",
                  "experience" : "5 yrs",
                  "firstName" : "Bob",
                }
            }
          }
      }
}
    }
aofdev
  • 1,772
  • 1
  • 15
  • 29
kurrodu
  • 2,108
  • 4
  • 32
  • 49

0 Answers0