Reputation: 1755
how do i grab the PUSH ID
generated from firebase push
method. I need to store this key
in my App.js
file for queries
in the future. im not sure how to grab this key when the user is already logged in. I posted a pic of what im reffering to, to clarify
Upvotes: 0
Views: 45
Reputation: 80914
To get the pushid based on the email provided, then try the following:
firebase.database().ref().child("users").orderByChild("email").equalTo(yourEmail).on("value", function (snapshot) {
snapshot.forEach(function(childSnapshot) {
var randomKey=childSnapshot.key;
});
});
The snapshot is at the node users
then you loop inside the keys and retrieve them using the key
property
https://firebase.google.com/docs/reference/js/firebase.database.DataSnapshot#key
Upvotes: 1