Firebase.updateData()

Update data in a Firebase child node per field.

This can be used to edit a single field within a child, or to add a new field entirely. You can find out more about which write option to use here: https://www.firebase.com/docs/web/guide/saving-data.html

Usage

Hover over inputs/exits for more info.

var Firebase = require('machinepack-firebase');


// Update data in a Firebase child node per field.

Firebase.updateData({

firebaseURL: 'your-firebase-database.firebaseio.com/users',

write: {},

child: 'users',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function () {

 

},

});

Inputs

firebaseURL required

The reference URL for your Firebase dataset. NOTE: Refer to the specific location you need to update as this machine can only work on one child level. For example, add /users/ to the URL, and the specific user as the child.

'your-firebase-database.firebaseio.com/users'
write required

The children to overwrite in the data path.

child

The child of your reference URL which you wish to write to.

'users'

Exits

error

An unexpected error occurred.

success

OK.