title: How get key from query Firebase in Javascript
body: <p>How to get the key where <code>UID</code> be equal to: <code>firebase.auth().currentUser.uid</code>, because I can update this information when the user enters new data.</p>
  
  <p>How to update the information? I use <code>orderByChild</code> and equal and set, but don't work.</p>
  
  <p><a href="https://i.stack.imgur.com/oiznA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oiznA.png" alt="enter image description here"></a></p>
  
  <p>My code: </p>
  
  <pre><code>updateUserInformation() {
    var ref = firebase.database().ref('/users/');
    ref.on('value', (snapshot) =&gt; {
      snapshot.forEach((child) =&gt; {
        if (child.val().UID == firebase.auth().currentUser.uid) {
          this.profileData = [{
            name: child.val().name,
            lastname: child.val().lastname,
            phone: child.val().phone,
            direction: child.val().direction,
            followQuantity: child.val().followQuantity,
            points: child.val().points,
            sex: child.val().sex,
          }];
          this.cdRef.detectChanges();
        }
      });
    })
  }
  </code></pre>