Get UID before pushing item to real time database

Hello Ionic friends :slight_smile:

I am having a problem in Ionic 3. I am trying to push an element into my database like this:

fireSneakers refers to ==>

fireSneakers = firebase.database().ref('/sneakers-list');

I would like to add my item with the UID like this I can refer to it when I push an image into the Firebase storage (and therefore the item is stored with it’s key UID and in the storage the image to the item is also stored with it’s UID ==> see (this.createPost(this.Picture, uid)))

I tried different ways to get the UID, like this for example:

uid : firebase.database().ref('/items/').push(s).key;

But it does not the job

Here is what I would like to have in my database :

Capture d’écran 2020-04-02 à 17.42.09

–> The UID : MpV2R2E50nORQnk3xIW1LAhyRlg1 would also refers to the attribute UID, and also to the image into my database storage when I upload (through the method createPost())

Thanks in advance :smiley: