This is how I have my database structured:
The following checks if flight MK2345 exists
fbSearch: function(){
var key;
var childData;
firebase.database().ref('/flights/').orderByChild("flight").equalTo('MK2345').on('value', function (snapshot) {
if (snapshot.exists()){
snapshot.forEach(function(childSnapshot) {
key = childSnapshot.key;
childData = childSnapshot.val();
console.log(childSnapshot.key)
});
}else{
console.log('not existing')
}
})
}
but I want it to check if the combination flight date and origin exists. As example: I'd like to check if the following combination exists: Date: 2019/07/23 Flight: MK1234 origin: AMS