title: Looping through a collection of Firebase Database records
body: <p>I am trying to iterate a collection of items from Firebase Database and later store it in my local storage, but its seems I can't figure out what wrong. I have actually read the documentation but still haven't figured out why the code doesn't work.</p>
  
  <p>Below is my code:</p>
  
  <pre><code>dataRef.once("value", function(snapshot) {
  
            snapshot.forEach(function(childSnapshot) {
  
              var hymn_no             = childSnapshot.val().hymn_no;
              var hymn_category       = childSnapshot.val().hymn_category;
              var hymn_key            = childSnapshot.val().hymn_key ;
              var hymn_title          = childSnapshot.val().hymn_title;
              var hymn_verses         = childSnapshot.val().hymn_verse;
              var hymn_chorus         = childSnapshot.val().hymn_chorus;
              var hymn_author         = childSnapshot.val().hymn_author;
  
              console.log(hymn_no);
              console.log(hymn_category);
              console.log(hymn_key);
              console.log(hymn_title);
              console.log(hymn_verses);
              console.log(hymn_chorus);
              console.log(hymn_author);
  
              var hymns = [
                  new Hymn({ 
                      "hymn_no": hymn_no, 
                      "hymn_category": hymn_category, 
                      "hymn_key": hymn_key, 
                      "hymn_title": hymn_title, 
                      "hymn_chorus": hymn_chorus,
                      "hymn_verses": hymn_verses, 
                      "hymn_author": hymn_author, 
                  }),
              ];
              localStorage.setItem("Hymns", JSON.stringify(hymns));
              return JSON.parse(localStorage.getItem("Hymns"));
            });
  
      });
  </code></pre>