【问题标题】:Firebase database cloud function on delete event删除事件上的 Firebase 数据库云功能
【发布时间】:2017-11-23 11:00:40
【问题描述】:

我想在某个表中删除某个值后运行云函数。 我查看了文档 (https://firebase.google.com/docs/functions/database-events),但没有找到与我的问题相关的任何内容。

Cloud Functions for Firebase 是否支持这样的事情?

【问题讨论】:

  • firebaser here 约翰的回答将在功能上为您提供您想要的。但它会为每次写入调用该函数,这意味着您还要为您不感兴趣的写入付费。我们已经听到许多开发人员要求触发更具体类型的写入操作,并且可能会增加对这些操作的支持在未来的版本中。

标签: android firebase firebase-realtime-database google-cloud-functions


【解决方案1】:

您应该可以使用以下内容:

exports.yourDeleteFunction = functions.database.ref(<your_ref>).onWrite(function (event) {

  // Exit if record still exists
  if (event.data.exists()) {
    return;
  }

  // Your code to handle delete

});

【讨论】:

猜你喜欢
  • 2019-11-08
  • 2020-05-15
  • 1970-01-01
  • 2018-01-08
  • 2020-10-10
  • 2020-03-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多