作者:mobiledu2502898347 | 来源:互联网 | 2022-12-06 16:53
我正在使用onWrite触发云功能。在onWrite函数中,我想对所写文档的ref ID做一些事情。我该怎么抓?我当前的代码看起来像这样,但是我不知道如何填充eventID。
exports.syncEvents = functions.firestore
.document('events/{eventID}')
.onWrite((change, context) => {
admin.firestore().collection('users').doc(host).collection('events').doc(eventID).set({
active: true
})
});
Doug Stevens..
5
change.after
是写入后已更改的文档的DocumentSnapshot。DocumentSnapshot有一个名为的属性id
,其中包含文档的ID。change.after.id
文档ID也是如此。
1> Doug Stevens..:
change.after
是写入后已更改的文档的DocumentSnapshot。DocumentSnapshot有一个名为的属性id
,其中包含文档的ID。change.after.id
文档ID也是如此。