title: How to save custom fields in Firestore during signing up for the first time?
body: <p>I'm using Email Authentication for signing up users. I want a Collection of users with their UID as the document name. Each document contains the Name and the email ID of the user. 
  In order to achieve this I've tried doing this,</p>
  
  <pre><code>public void addUser(View view){
      progressDialog.setMessage("Adding Please Wait...");
      progressDialog.show();
  
  
      final String name = String.valueOf(etName.getText());
      final String email = String.valueOf(etEmail.getText());
      String password = String.valueOf(etPassword.getText());
  
      Map&lt;String,Object&gt; faculty = new HashMap&lt;&gt;();
      faculty.put("name", name);
      faculty.put("email", email);
  
      firebaseAuth.createUserWithEmailAndPassword(email, password)
              .addOnCompleteListener(this, new OnCompleteListener&lt;AuthResult&gt;() {
                  @Override
                  public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
                      //checking if success
                      if(task.isSuccessful()){
                          Toast.makeText(AddFaculty.this, "Success!", Toast.LENGTH_SHORT).show();
                      }else{
                          //display some message here
                          Toast.makeText(AddFaculty.this,"Error",Toast.LENGTH_LONG).show();
                      }
                      progressDialog.dismiss();
                  }
              });
  
  
      if(firebaseAuth.getCurrentUser() != null) {
          String uid = firebaseAuth.getCurrentUser().getUid();
  
          reference = firestore.collection("faculty").document(uid);
          reference.set(faculty);
          Toast.makeText(this, "Data added", Toast.LENGTH_SHORT).show();
      }
      else {
          Toast.makeText(this, "Data not added", Toast.LENGTH_SHORT).show();
      }
  }
  </code></pre>
  
  <p>This method gets called when the Signup button is clicked.
  The problem here is that the "DATA ADDED" toast is shown, but the data is not being saved.
  But the data is saved if I hardcode the Document name instead of passing the UID of the user, eg:</p>
  
  <pre><code>reference = firestore.collection("faculty").document(uid); //Doesn't work
  reference = firestore.collection("faculty").document("user_id") //Works perfectly
  </code></pre>
  
  <p>This issue has been bothering me for almost a week now.
  Any help would be greatly appreciated. Thank you!</p>