【发布时间】:2018-08-01 01:39:39
【问题描述】:
我有这个功能可以通过functions.firestore.document().onUpdate() 监听Firestore Document 的更新。
这是我想如何处理它的 sn-p:
exports.createItem = functions.firestore
.document('list/{itemId}')
.onUpdate((change, context) => {
const ref = REFERENCE_TO_DOCUMENT_CHANGED; // how to do this?
const changedData = change.after.data();
const changedValueId = changedData.id;
const create = admin.firestore().doc(`newlist/${changedValueId}`);
create.set({
item: ref,
...changedData
});
});
【问题讨论】:
标签: javascript node.js firebase google-cloud-firestore google-cloud-functions