firebasepolymer-1.0polymerfire

How to get the generated key of the saveValue method in Polymerfire?


So I'm using this method saveValue and only using the path parameter. The method is generating a unique key and data is stored while I'm inserting text in my input fields...

My question now is: How can I get to know what the new key is?

Regards, Peter


Solution

  • This is an old question but I just came across this issue. The answer is that the new path is saved to the path property of the firebase-document used to call saveValue.

    <firebase-document id="NewUserSync"></firebase-document>
    

    ...In some click handler....

    this.$.NewUserSync.path = null;
    this.$.NewUserSync.data = OrgData;
    this.$.NewUserSync.saveValue(`/Customer_Orgs/`).then(resp => {
                console.log(this.$.NewUserSync.path);
                // /Customer_Orgs/-LH_pEzgWJpv3mpYYTuA     
    
              })