简体   繁体   中英

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' }); })

I have change the code like this

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM