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,724
  • 1
  • 13
  • 28
kurrodu
  • 1,996
  • 3
  • 27
  • 47

0 Answers0