title: How to get Key / Id of the data written into Firebase?
body: <p>I have a application which stores employee records, it stores the employees ID, but also needs each employee to have a local ID, I want to use the ID generated by Firebase when we push data onto the db using <code>push()</code> function as the internal ID for each employee. This is required for change management.</p>
  
  <p>My code:</p>
  
  <pre><code>function submit()
      {
  
  
      var dsRef=new Firebase("https://dataretrievaltest-28983.firebaseio.com/EmployeeDB/EInfo");
  
      var name=document.getElementById('Name').value;
      var eid=document.getElementById('EID').value;
      var email=document.getElementById('Email').value;
  
      dsRef
                      .push(
                              {
                              Name:name,
                              EID: eid,
                              Email: email,
                              }
                          );
  
      var pushid=dsRef.name;
      console.log("name:"+pushid);
      console.log(name);
      console.log(eid);
      console.log(email);
  
      } 
  </code></pre>
  
  <p>Output of the above code:</p>
  
  <pre><code>name:function (){S("Firebase.name() being deprecated. Please use Firebase.key() instead.");D("Firebase.name",0,0,arguments.length);return this.key()}
  savekey.html:104 Djoko
  savekey.html:105 0143
  savekey.html:106 Djoko@dept.com
  </code></pre>
  
  <p>Have used Key in place of name as name is deprecated but did not get the key, instead it returns a function.</p>
  
  <p>The code with key in place of name</p>
  
  <pre><code>var pushid=dsRef.key;
  console.log("name:"+pushid);
  </code></pre>
  
  <p>Output after change:</p>
  
  <pre><code>name:function (){D("Firebase.key",0,0,arguments.length);return this.path.e()?null:me(this.path)}
  savekey.html:104 Caroline
  savekey.html:105 0192
  savekey.html:106 caroline@dept.com
  </code></pre>
  
  <p>I need the Keys viz -Kb5... : which is seen in below Json </p>
  
  <pre><code>"EInfo" : {
        "-Kb5UunYfq-8zd_Jc2Nd" : {
          "EID" : "0134",
          "Email" : "Parker@dept.com",
          "Name" : "Parker"
        },
        "-Kb5V9xHhzVix6BNRM78" : {
          "EID" : "1024",
          "Email" : "sanchez@dept.com",
          "Name" : "sanchez"
        }
  }
  </code></pre>
  
  <p>The available properties(key/name) don't give the required output. Please let me know how to retrieve the key and if I am missing anything.</p>
  
  <p>Also tried </p>
  
  <pre><code>var pushid=dsRef.child("EInfo").push().key;
  console.log("name:"+pushid);
  </code></pre>
  
  <p>it did not give the desired result.</p>
  
  <pre><code>name:function (){D("Firebase.key",0,0,arguments.length);return this.path.e()?null:me(this.path)}
  savekey.html:104 camila
  savekey.html:105 0172
  savekey.html:106 camila@dept.com
  </code></pre>