firebase - 是否可以同时使用2个或更多onwrite firebase云功能?

标签 firebase google-cloud-functions

我希望我的云函数根据数据库写入发生的位置而采取不同的行为。

例如:

functions.database.ref('queues/login/{uid}').onWrite(event => {
//do something here
});
functions.database.ref('queues/login/{uid}/status').onWrite(event => {
//do another thing here
});
functions.database.ref('queues/login/event').onWrite(event => {
//do something else
});

这可能吗?如果没有,我必须将它们全部收集到 1 个 onwrite 触发器中,我该如何使用 if 子句来做到这一点?

提前致谢

最佳答案

是的,您绝对可以在同一项目中定义多个数据库触发器。您甚至可以在同一位置定义多个触发器。

关于firebase - 是否可以同时使用2个或更多onwrite firebase云功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48330216/

相关文章:

go - 尝试通过 vendor 目录部署Google Cloud功能时出错

javascript - 从 Cloud Functions for Firebase 中的数据库触发器获取用户 ID?

javascript - Google Firestore - 如何在一次往返中通过多个 ID 获取多个文档?

找不到 Firebase Crashlytics IOS SourcePackages

firebase - 火存储 : How to query a map of roles inside a subcollection of documents?

typescript - 无法从 Firestore 获取文档

http - Google Cloud Function 请求被中止,因为没有可用的实例

ios - 在设备上捆绑 Firebase JavaScript 无服务器代码以供离线访问

ios - 火力地堡 ".read": "auth != null && auth.uid == $uid" not working as expected

image - 显示来自 Firebase 存储的图像时出现 404 错误