title: How to get count of nodes in firebase database?
body: <p>Can i know the below code is correct to receive the count of nodes in firebase database by status?</p>
  
  <pre><code>// Add Auth State Changed event listener
  auth.onAuthStateChanged(user =&gt; {
      if (user) {
          self.user = user;
          db.child('referrals').orderByChild("uid").equalTo(user.uid).on("child_added", function (snapshot) {
              if (snapshot.val().status == 0)
                  self.submitted++;
              else if (snapshot.val().status == 1)
                  self.pending++;
              else if (snapshot.val().status == 2)
                  self.approved++;
          });
      } else {
          console.log('not logged in');
          $location.path('').replace();
      }
  });
  </code></pre>