使用云端功能添加子项? [英] Add child using Cloud Functions?
本文介绍了使用云端功能添加子项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用云端函数在 .onWrite
之后添加子项?
How do I add a child after .onWrite
using Cloud Functions?
Code skeleton:
exports.addNewValue = functions.database.ref('/messages/{pushId}')
.onWrite(event => {
// add child newValue: "randomValue" to the newly added key above
解决方案
If you want to update the database at the same location where the change occurred with some key/value pair:
event.data.adminRef.update({key:"value"})
I suggest also getting acquainted with the documentation for how to work with database triggers, and how to write to Realtime Database using the JavaScript API.
这篇关于使用云端功能添加子项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文