title: How To Store Firebase Users Under UID
body: <p>I have been storing all my users in my firebase database using the push() method.  This method generates a unique id for each user and stores them under this id.  I am trying to change this so that my users are stored under a user.uid that is auto generated as well when you use the set() method, however, I'm having trouble storing them under this user uid.  </p>
  
  <p>I am using the following to add users to the database, what am I missing here?</p>
  
  <pre><code>firebase.database().ref().child('accounts').set({
                  email: user.email,
                  userId: firebase.auth().currentUser.uid
  
                })
  </code></pre>
  
  <p>this uses set() and stores the data like this:</p>
  
  <pre><code>{
    "accounts" : {
        "email" : "",
        "userId" : ""
      },
  {
        "email" : "",
        "userId" : ""
      }
  }
  </code></pre>
  
  <p>Using push() the structure looks like this:
  The users are stored based on the firebase generated push Id.</p>
  
  <pre><code>{
    "accounts" : {
      "-KRPSyO4B48IpBnHBTYg" : {
        "email" : "",
        "userId" : ""
      },
      "-KR4f4s5yvdr67g687nrth" : {
        "email" : "",
        "userId" : ""
      }
    }
  </code></pre>
  
  <p>What I'm looking for is this structure:
  Users are stored by the firebase generated userId..</p>
  
  <pre><code>{
        "accounts" : {
          "userId value" : {
            "email" : "",
            "userId" : ""
          },
          "userId value" : {
            "email" : "",
            "userId" : ""
          }
        }
  </code></pre>
  
  <p>Any help would be greatly appreciated!!</p>