"Company" : {
"-KRRqrR3Z3R8u1wRW6dd" : {
"PersonalInfo" : {`
"address" : "bakakeng",
"birthday" : "1992",
"firstName" : "Saoud",
"gender" : "Male",
"midName" : "Ahmed",
"phoneNo" : "12a12a12a",
"surName" : "Al- Maari"
},
"Qualification" : {
"Degree" : "PHD",
"Expreince" : "Doctor"
}
},
"-KRS1Jp2hhAbtLNx9jmq" : {
"PersonalInfo" : {
"address" : "sfsfsf",
"birthday" : "sfsfsfs",
"firstName" : "dfdsf",
"gender" : "sfsf",
"midName" : "sfsf",
"phoneNo" : "123456789",
"surName" : "jfkldsf"
}
}
}
答案 0 :(得分:1)
只要该孩子处于固定路径,您就可以通过嵌套孩子进行排序。
在JavaScript中:
var query = ref.child("Company ").orderByChild("PersonalInfo/phoneNo");
query.on('child_added', function(snapshot) {
console.log(snapshot.val());
});