【发布时间】:2021-07-23 08:28:25
【问题描述】:
如何在每次触发 Firebase 函数 onWrite 时在不同节点下监听子节点
这个孩子 = {const saatt = (context.database .ref('kullanicilar/1111/marina1/2021/1saat').once('value')).val();}
exports.pushNotification = functions.database.ref('kullanicilar/1111/marina1/realtime/control')
.onWrite((Change,context) =>{
var oldDeger = Change.before.val();
var newDeger = Change.after.val();
if (newDeger > oldDeger){
const saatt = (context.database
.ref('kullanicilar/1111/marina1/2021/1saat').once('value')).val();
if (saatt === 0){
database.ref('kullanicilar/1111/marina1/realtime/ufuk').set('tamm');
}
}
});
【问题讨论】:
-
请分享你的数据库结构截图,他说明你想在哪个节点触发函数
-
我建议您查看 Cloud Functions for the Realtime Database 文档中专用于 path 的部分。
标签: javascript node.js google-cloud-functions