我正在尝试使用以下方法查询Firebase数据库以获取所有userId,其注册状态为approved
,但我无法使用。
有人可以建议/指导我如何做到这一点吗?
var registeredUsersRef = firebaseDB.ref("users/registered/");
registeredUsersRef.orderByChild("registrationData").orderByChild("registrationStatus").equalTo("approved").once('value', snapshot => {
}
以下是我的示例数据结构
{
"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",
}
}
}
}
}
}