【发布时间】:2017-10-18 19:34:16
【问题描述】:
知道为什么我不能使用 childByAutoId 吗?
exports.addPersonalRecordHistory = functions.database.ref('/personalRecords/{userId}/current/{exerciseId}')
.onWrite(event => {
var path = 'personalRecords/' + event.params.userId + '/history/' + event.params.exerciseId;
var reference = admin.database().ref(path).childByAutoId();
reference.set({
username: "asd",
email: "asd"
});
});
错误
TypeError: admin.database(...).ref(...).childByAutoId is not a function
at exports.addPersonalRecordHistory.functions.database.ref.onWrite.event (/user_code/index.js:18:111)
【问题讨论】:
标签: firebase firebase-realtime-database google-cloud-functions