如何使用Firebase自动删除用户数据

时间:2022-09-06 16:28:15

I created an application and use Firebase as backend. In my application User can upload images and these images should be deleted after one week from the database. I don't know how I can delete stuff automatically and after an amount of time because the code is running on the devices of the user and maybe there will be hundreds of user. Does anyone have any idea how I can achieve that please ? Thanks

我创建了一个应用程序并使用Firebase作为后端。在我的应用程序用户可以上传图片,这些图片应该在一个星期后从数据库删除。我不知道如何自动删除东西,过一段时间后,因为代码在用户的设备上运行,可能会有数百个用户。有谁知道我该怎么做吗?谢谢

1 个解决方案

#1


1  

AFAIK Firebase doesn't have support for adding a parameter to a query. You could try adding Cloud Function with a trigger to run a delete query when something is written to the database. https://firebase.google.com/docs/functions/gcp-storage-events

AFAIK Firebase不支持向查询添加参数。您可以尝试在写入数据库时添加一个触发器来运行delete查询。https://firebase.google.com/docs/functions/gcp-storage-events

#1


1  

AFAIK Firebase doesn't have support for adding a parameter to a query. You could try adding Cloud Function with a trigger to run a delete query when something is written to the database. https://firebase.google.com/docs/functions/gcp-storage-events

AFAIK Firebase不支持向查询添加参数。您可以尝试在写入数据库时添加一个触发器来运行delete查询。https://firebase.google.com/docs/functions/gcp-storage-events