【问题标题】:Automatic Cloud Firestore Updating [duplicate]自动 Cloud Firestore 更新 [重复]
【发布时间】:2018-03-08 19:44:04
【问题描述】:

我希望根据用户选择要输入数据库的数据的时长自动删除某些集合下的数据。

是否有我可以应用的特定 google firebase/cloud firestore 机制/方法等。

我该怎么做呢?

【问题讨论】:

标签: ios swift firebase cloud google-cloud-firestore


【解决方案1】:

安排 Cloud Functions 怎么样?

我没有创建这样的机制,但这似乎适合您的场景。 Google 博客上有一篇关于这种方法的文章:https://firebase.googleblog.com/2017/03/how-to-schedule-cron-jobs-with-cloud.html

【讨论】:

  • 如何在我的应用程序中使用 Swift 实现这一点?没有 Python 或 Node.js 有没有办法做到这一点?
  • Cloud Firestore 中没有内置的生存时间支持。 Cloud Functions 仅在 Node.js 中运行。你可以找到sample of this in the functions-samples repo
  • 所以我的云函数必须从我的 firestore 数据库中获取数据(在从我的应用程序上获取用户的输入之后),然后通过 node js 中的函数删除条目?
  • 是的,您可能想将此逻辑分离到 nodejs 云函数中(适合您的某种后端)。在 Swift 应用程序中创建这种机制似乎不是一个好主意 :)
  • @sarneeh 我们需要我们的云功能始终监控 Firestore 数据库中条目的过期时间戳。我们可以在 Cron 作业上使用的最短时间间隔是 1 分钟。大家有什么建议吗?
猜你喜欢
  • 1970-01-01
  • 2021-01-06
  • 1970-01-01
  • 1970-01-01
  • 2020-12-09
  • 2019-09-14
  • 2018-09-21
  • 1970-01-01
  • 2019-07-12
相关资源
最近更新 更多