Reputation: 25
Here I want to modify value of ADDRESS Field. Here the value 1R6RsMMgQ.... represents the uid of each user. Here I am able to reach upto userDetails but I am unable to go to address key for modifying the value. Here the -MXcKsJV... value is the array key value which is generated at the time of pushing the value to database using the push() method.
I tried to update the value by writing this query
firebase.database().ref(`/user/${uid}/userDetails/`).update({address: 'change'})
By writing this query I would update the userDetails child but this would not been reflected in the array (i.e. -MXcKs... array)
Can anyone suggest me how to do this?
Upvotes: 0
Views: 333
Reputation: 871
Your ref is to /user/1R6.../userDetails/ and not /user/1R6.../userDetails/-MXcK... You have to update your ref or fix your data structure.
Upvotes: 1