【发布时间】:2018-05-15 15:45:02
【问题描述】:
所以在我的 firebase 应用程序中,我想在数据源更新时访问一个数组。
这部分应用运行良好。变量赋值成功。
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'
}
};
});
我要访问和循环的数组位于“Groups/{groupId}/listeners”中。
如何访问它?
【问题讨论】:
标签: node.js firebase firebase-realtime-database google-cloud-functions