So in my firebase app, I want to access an array whenever the data source is updated.
This part of app works well. The variables are assigned successfully.
exports.sendUsersNotification = functions.database.ref('/Groups/{groupId}/messageList/{messageId}/')
.onWrite(event => {
const original = event.data.val();
let userId = original['userId']
let groupId = event.params.groupId;
let messageId = event.params.messageId;
const payload = {
notification: {
title: 'Messenger',
body: 'You have a new message'
}
};
});
The array I want to access and loop through is in 'Groups/{groupId}/listeners'.
How can I access it?