Skip to content Skip to sidebar Skip to footer

Add Child Using Cloud Functions?

How do I add a child after .onWrite using Cloud Functions? Code skeleton: exports.addNewValue = functions.database.ref('/messages/{pushId}') .onWrite(event => { // add child ne

Solution 1:

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.

Post a Comment for "Add Child Using Cloud Functions?"