简体   繁体   中英

How do I retrieve specific data from firebase web

json file of firebase is like

 { "users": { "a540678c0fda89f430bfba480ffe6f40146548bad72c199f8536b167fc58455a" : { "password" : "2a97516c354b68848cdbd8f54a226a0a55b21ed138e207ad6c5cbb9c00aa5aea", "phone" : "+91xxxxxxx", "uid" : "demo" } } }

how do i get value for password, phone and uid using ref().once().then() syntax

This should work:

var ref = firebase.database().ref("users/a540678c0fda89f430bfba480ffe6f40146548bad72c199f8536b167fc58455a");
ref.once("value").then(function(snapshot) {
  var user = snapshot.val();
  console.log(user.password, user.phone, user.uid);
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM