title: On creating a user adding an instance of that user to Firebase database?
body: <p>Here is the task. When a user is created, I would like to add an instance of them in the main database so they can then have things associated with them (lists and recipes). I tried doing <code>.set()</code> and <code>.update()</code> and while both added an instance of the user in my DB, it would get overwritten each time a new user registered. How would I go about not having that information overwritten? I will keep searching and update my post based on the information I have found. Here is the auth code I have. </p>
  
  <pre><code>app.controller("SampleCtrl", ["$scope", "Auth",
    function($scope, Auth) {
      $scope.auth = Auth;
  
      $scope.createUser = function() {
        $scope.message = null;
        $scope.error = null;
  
        // Create a new user
        Auth.$createUserWithEmailAndPassword($scope.email, $scope.password, $scope.name)
          .then(function(firebaseUser) {
            $scope.message = "User created with uid: " + firebaseUser.uid;
            const uid = firebaseUser.uid;
            const dbref = firebase.database().ref().child('users');
            dbref.update({
              id: uid,
              name: $scope.name
            });
              console.log(dbref.uid);
          }).catch(function(error) {
            $scope.error = error;
          });
      };
  
      $scope.deleteUser = function() {
        $scope.message = null;
        $scope.error = null;
  
        $scope.auth.$onAuthStateChanged(function(firebaseUser) {
        $scope.firebaseUser = firebaseUser;
      });
  
        // Delete the currently signed-in user
        Auth.$deleteUser().then(function() {
          $scope.message = "User deleted";
        }).catch(function(error) {
          $scope.error = error;
        });
      };
    }
  ]);
  </code></pre>
  
  <p>Thanks in advance!</p>
  
  <p>******EDIT**********</p>
  
  <p>Okay, so I got information to be added, but not in the way I expected. I want the structure to be like this 
  users
  ----- id
  -------info
  Where id is the key and info is the value that holds a new object. 
  What I am getting is this...
  <a href="http://i.stack.imgur.com/ceDXY.jpg" rel="nofollow">a random serialized ID and then my user id and information object</a></p>
  
  <p>The question is now, how do I get rid of that random serialized key?</p>