如何修改下面的代码,以便添加儿童 时,函数仅触发?当前,每次指定的参考都会发生更改时触发该函数...
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
exports.myFunction = functions.database.ref('/messaging/{pushId}')
.onWrite(event => {
//child is added. Do something!
});
使用onCreate()处理程序代替 onWrite()
。
exports.myFunction = functions.database.ref('/messaging/{pushId}')
.onCreate(event => {
//child is added. Do something!
});