firebase - 有没有办法知道文档是否已使用 firebase 函数添加到 firebase 的集合中
问题描述
基本上又是一个问题:
假设有一个名为“People”的集合。
Firestore 函数可以检测对特定文档的更改,但是是否知道何时使用 firebase 函数将文档(例如“Person1”)添加到集合中?
如果没有,是否有其他方法可以了解何时添加文档?
解决方案
有一个特定的函数类型,仅在创建文档时触发。从文档中可以看出如何使用它的示例:
exports.createUser = functions.firestore .document('users/{userId}') .onCreate((snap, context) => { // Get an object representing the document // e.g. {'name': 'Marie', 'age': 66} const newValue = snap.data(); // access a particular field as you would any JS property const name = newValue.name; // perform desired operations ... });
推荐阅读
- python - 找不到适用于 python 的 mb_protocol 模块
- prometheus - 在同一张图中聚合不同的普罗米修斯指标
- sql - 如何从“日期” - 2 周和“日期” + 2 周过滤日期范围
- r - 用 ggplot 改变 ylim
- python - 是否有一些用于 aiohttp 的缓存库,例如用于请求的 CacheControl?[Python]
- c++ - 类中的 Bool 成员变量在未初始化时设置为 True
- python - Docker Compose Nginx 内部服务器错误
- python - 删除熊猫数据框中的所有特殊字符
- angular - 如何避免带有逻辑和副作用的嵌套订阅
- html - 无法在 asp.net core 中正确显示背景图像