I can't update data from firebase because of the random given character

こ雲淡風輕ζ 提交于 2021-02-05 11:19:26

问题


Here is my firebase i don't know how to enter or get that path in firebase and i want to change the password inside that random character

my database


回答1:


To update a specific value in the database, you must know the full path to that value.

If you know the email address, but not the key that email address, you can use a query to look up all child nodes of users with that email address.

let query = firebase.database.ref("users").orderByChild("email").equalTo("gagfa@john.com");

Then you can load the data matching this query, iterate over the results (as there can be multiple) and update the property:

query.once("value").then((snapshot) => {
  snapshot.forEach((userSnapshot) => {
    userSnapshot.ref.child("password").set("CorrectHorseBatteryStaple");
  });
});

Unrelated to your question, but please read Why are plain text passwords bad, and how do I convince my boss that his treasured websites are in jeopardy? and reconsider storing passwords in plain text.



来源:https://stackoverflow.com/questions/58524797/i-cant-update-data-from-firebase-because-of-the-random-given-character

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!