This is my firebase data
users
-L2yfvAU0cihwcJHqIv9
City: "wah cantt"
Email: "[email protected]"
Firstname: "sharjeel"
Lastname: "malik"
Latitude: "74.27559833333333"
Longtitude: "31.509099999999997"
Phone: "03035602137"
Username: "sharjeel089"
This is my current cloud function
exports.retreivefromdatabase = functions.https.onRequest((req,res) => {
var db = admin.database();
var ref = db.ref();
ref.on("value", function(snapshot){
res.send(snapshot.val());
});
});
This function retrieves all data from firebase database. I just want to retrieve user data in the form of key value pairs like this on the basis of username.
{"City": "wah
cantt","Email":"[email protected]","Firstname":"sharjeel"........}
How to do that?