Add a child using Cloud features?

How to add child after .onWrite using cloud functions?

enter image description here

Code skeleton:

 exports.addNewValue = functions.database.ref('/messages/{pushId}') .onWrite(event => { // add child newValue: "randomValue" to the newly added key above 
0
javascript firebase firebase-database google-cloud-functions
source share
1 answer

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.

0
source share

All Articles