komal deep singh chahal komal deep singh chahal - 1 year ago 125
React JSX Question

Comparing and updating the fields in firebase database

enter image description here

I am trying to update Username password group name.
I am trying like this, but it is not updating

I want to camapre and then update my fields, but i can't find a way to do that.

Like where email = komaldeep1993@gmail.com
update there;

my code looks like this.

var newData = {
Username: this.username.value,
Password: this.password.value,
User_Group: this.User_Group.value,

var email = this.state.edit_details[0];


this is not working , help me updating the specific field by camparting data in database

Answer Source

You cannot call update() on a query. You will need to call it on the DatabaseReference of each specific child that is matched by that query:

var query = firebase.database().ref("/Cred_Details_Of_Users").orderByChild("Email_Address").equalTo(email);
query.on("child_added", function(snapshot) {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download