How to update the value of a key in firebase Realtime database (JavaScript)

Viewed 29

I want to update the value of the key on firebase Realtime Database but I was not able to update the value my database structure is like this.

{
BoardID:23df2365k87 //want to update the value of BoardID
}

This is the code I am trying

let BoardID = app.ref('BoardID');
app.ref('/BoardID').on('value', (snapshot) =>{
    console.log(snapshot.val())
   let bordid = snapshot.val();
   console.log(bordid);
   BoardID.val().update({
    'Null'

});
})

1 Answers

I have change the code like this

app.ref("/BoardID").set('two');

Related