title: Email as id in firebase
body: <p>Instead of using <code>push()</code> to generate <code>id</code> for <code>child(user)</code>, can I use email of user as <code>id</code> in Firebase?</p>
  
  <p>I tried this:</p>
  
  <pre><code>    private void userData(String emai1, String pass, String bal) {
  
      String id = emai1;
      int balance=Integer.valueOf(String.valueOf(bal));
      User user1 = new User(id,emai1,pass,balance);
      databaseReference.child(id).setValue(user1);
  
  }
  </code></pre>
  
  <p>User class:</p>
  
  <pre><code>public class User {
  
   private String email;
   private int balance;
   private String password;
   private String id;
  
  public User( String id,String email, String password , int balance) {
      this.email = email;
      this.balance = balance;
      this.password = password;
      this.id = id;
  }
  
  
  
  public String getEmail() {
      return email;
  }
  
  public void setEmail(String email) {
      this.email = email;
  }
  
  public int getBalance() {
      return balance;
  }
  
  public void setBalance(int balance) {
      this.balance = balance;
  }
  
  public String getPassword() {
      return password;
  }
  
  public void setPassword(String password) {
      this.password = password;
  }
  
  public String getId() {
      return id;
  }
  
  public void setId(String id) {
      this.id = id;
  }
  
  }
  </code></pre>
  
  <p>Since I have used firebase auth, user gets registered but his info does not get added to firebase database.</p>
  
  <p>Btw, before trying this, I was using <code>push()</code> to get the <code>id</code> and everything was working fine, but I want email as <code>id</code> instead generating a new <code>id</code>(since emails are unique anyway.)</p>