【发布时间】:2019-02-21 16:14:53
【问题描述】:
我是 Firebase 云功能的新手,每次创建文档时我都会尝试在文档中写下数据,但从未写入数据,我在控制台中也没有出现错误。我错过了什么?我正在使用 Firestore。
exports.updateclient = functions.firestore
.document('patients/{clientId}')
.onCreate(async (snap, context) => {
const database = admin.firestore();
const settings = {timestampsInSnapshots: true};
database.settings(settings);
const clientId= context.params.clientId;
const patientRef = database.collection('patient').doc(clientId);
return patientRef.set({ id: clientId}, {merge: true});
});
【问题讨论】:
标签: javascript typescript firebase google-cloud-firestore