I am using Javascript with Firebase and I want to make a query on a value exist on the second or the third level, My DB is like that :
Users :
        -KNwBd5cF6iY9dWh0eFd :
                name: "Jon Snow"
                phones:
                    phone1: "0123456789"
                    phone2: "0123456987"
And I want to make a query on the phone1 value, I am using orderByChild to query the DB for now and my code is :
var ref = firebase.database().ref("users");
ref.orderByChild("name").equalTo("Jon Snow").on("value", function(snapshot) {
    console.log(snapshot.val());
});
But I can only use it to query on the value of the first level of values but how to make another query on the second or third level.
 
    