使用 Cloud Functions 添加 child?

Add child using Cloud Functions?

如何使用 Cloud Functions 在 .onWrite 之后添加 child?

代码框架:

exports.addNewValue = functions.database.ref('/messages/{pushId}')
.onWrite(event => {
// add child newValue: "randomValue" to the newly added key above

如果您想在某些 key/value 对发生更改的相同位置更新数据库:

event.data.adminRef.update({key:"value"})

我还建议您熟悉有关如何使用 JavaScript API.

使用 database triggers, and how to write to Realtime Database 的文档