简体   繁体   English

如何更新 firebase 实时数据库 (JavaScript) 中键的值

[英]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.我想更新 firebase 实时数据库上的键值,但我无法更新我的数据库结构的值是这样的。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 对于或同时使用 Javascript 和 Firebase 实时数据库 - For or While with Javascript and Firebase Realtime Database 如何使用 Firebase 9(模块化 sdk)更新 Firebase 实时数据库中的数据 - How to update data in Firebase realtime database using Firebase 9 (modular sdk) Firebase 实时数据库值检索 - Firebase Realtime Database Value Retrieval 如何在 Firebase 实时数据库规则中将键解析为数字? - How to parse key as a number in a Firebase Realtime Database rule? 如何正确更新 firebase-realtime-database 中的对象? - How to update an object in firebase-realtime-database correctly? firebase 实时数据库更新值两次 - firebase realtime database updating value twice 如何在 Firebase 实时数据库 Unity 中按字符串和数字中的值对数据库中的子项进行排序 - How do I order children in a database by value in strings and numbers in Firebase Realtime Database Unity 如何从 javascript 中的 firebase 实时数据库中获取子节点的总数? - How do I fetch the total number of child nodes from my firebase realtime database in javascript? 如何将列表推送到 Firebase 实时数据库 - How to push a list to Firebase Realtime Database 将新属性更新到现有节点 firebase(实时数据库)(编辑) - update new attribute into exists node firebase(realtime database) (edit)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM