I know that there are 1,000 answers out there to this question, which is partially why I'm so confused by the fact that I can't get it to work.
I can't get the orderByChild query / filter to work. I've looked at at least 25 tutorials, guides, and articles online that explain it and they all seem to say to do exactly what I'm doing:
var dbRef = firebase.database().ref();
var filterExperience = dbRef.child("Users").orderByChild('trade_general').equalTo('Construction');
filterExperience.on('child_added', snap => {
// Just trying to figure out if anything's even happening
console.log("Test" + snap.val());
// Set Card ID
$('#cand-card').attr('id', 'cand-card' + snap.key);
// Set Name
$('#fullname').attr('id', 'fullname' + snap.key);
$('#fullname' + snap.key).text(snap.child("Personal").child("first_name").val() + " " + snap.child("Personal").child("last_name").val());
// And so on...
My database looks like this:
Users
|
|--KYQ0L5TStcZM1rgVpte
|
|-Account
|-Availability
|-Education
|-Location
|-Work_History
|
|-Recent_Job_1
|
|-employer_name: "abc company"
|-job_position: "concrete finisher"
|-job_years: "2"
The result that I'm getting is: absolutely nothing. Nothing in the console from that test that I run right after the 'snap'. Nothing on the page.
Thanks in advance for your help!
Also, this is the first time I've ever posted here, so if I've left out anything critical (which I likely have) just let me know.
Aucun commentaire:
Enregistrer un commentaire