How to add child after .onWrite using cloud functions?
.onWrite
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 in the same place where the changes occurred with some key / value pair:
event.data.adminRef.update({key:"value"})
I also suggest that you read the documentation on how to work with database triggers , and how to write to a Realtime database using the JavaScript API.