I have this code below which works (no syntax or any other errors) except that the output of this code displays all the results under /server/name:
i.e:
We have a new event: { des: 'test123', name: 'Test', nice: 'wew' } lol Here is the Code in functions/index.js:
exports.sendFollowerNotification = functions.database.ref('/server/name').onWrite(event => { admin.database().ref("/server/name").limitToLast(1).on('child_added', function(snapshot) { console.log('We have a new event:', snapshot.val()); }); Here is the DB:
Update 2:
exports.sendFollowerNotification = functions.database.ref('/server/name/{num}').onWrite(event => { console.log('We have a new event:', event.data.val(), 'lol'); }); Output in Logs:
Update 3:
And



event.data.val()returns all data too. I don't know how to modifyfunctions.database.ref('/server/name').onWriteto return new elements only