【发布时间】:2017-12-06 01:24:52
【问题描述】:
exports.respublished =
functions.database.ref('/Posts/{postid}').onWrite(event => {
const snapshot = event.data;
const postid = event.params.examid;
const uid = snapshot.child('uid').val();
const ispublic = snapshot.child('Public').val();
firebase.database.ref('Users/' + uid).once(event => {
const snapshot = event.data;
const name = snapshot.child('name').val();
});
});
该事件由另一个节点触发,我想从 firebase 数据库的另一个节点检索数据。我已经尝试了上面的代码,但它会产生一个错误,说 TypeError: firebase.database.ref(...).once is not a function。
【问题讨论】:
-
您确定确切的错误信息吗?你的意思是
firebase.database.ref().once?如果是这样,firebase是什么?你是在别的地方定义的吗?
标签: javascript firebase firebase-realtime-database google-cloud-functions