【发布时间】:2019-10-01 14:15:24
【问题描述】:
我正在开发一个使用 collectionGroups 的 Firestore 数据库。
有问题的 collectionGroup 是“Fights”的集合。
创建新战斗时,我想使用云函数中的 onCreate 方法来监视新的“战斗”条目,然后向它们添加一些元数据。理想情况下,它看起来像下面的伪代码
export const placeFightersInEvent = functions.firestore
.collectionGroup('fights/{fightId}')
.onCreate(async (fightSnapshot, context) => {
// get metadata and add to the newly created 'fight'
});
我正在使用最新版本的 firebase 函数和 admin sdk,但我似乎找不到可用的函数来执行此操作。这种方式可以看收藏组吗?
【问题讨论】:
标签: firebase google-cloud-firestore google-cloud-functions