MOHAMMAD ZEESHAN
MOHAMMAD ZEESHAN

Reputation: 283

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

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'

});
})

Upvotes: 1

Views: 131

Answers (1)

MOHAMMAD ZEESHAN
MOHAMMAD ZEESHAN

Reputation: 283

I have change the code like this

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

Upvotes: 2

Related Questions