仍在检索已删除的Firestore文档 [英] Deleted Firestore documents still being retrieved

查看:45
本文介绍了仍在检索已删除的Firestore文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过从Cloud Functions中的触发器中批量删除删除了一些文档.控制台显示它们已被删除,但是,我的应用程序仍会检索文档!这一定是firestore中的一个错误,这是一个非常重要的错误.我发现此处

I have deleted some documents through a batch delete from a trigger in Cloud Functions. The console shows them as being deleted, however, my app still retrieves the docs! This has got to be a bug with firestore and it's a pretty major one. I found another user had the same problem here

我正在使用的路径是/users/{id}/timeline/{postId}.我删除了特定的postId.

The path I'm using is /users/{id}/timeline/{postId}. I deleted a specific postId.

推荐答案

可能是您遇到了问题,该应用使用了缓存并从中加载了一些文档.您可以尝试的一件事是禁用离线持久性.

Probably you have the problem, that the app uses the cache and loads as well some documents from it. One thing you could try is to disable the offline persistence.

如果您使用的是带有实时数据库的Android 您可以尝试以下方法:

If you're using Android with Real-Time Database you could try this:

FirebaseDatabase.getInstance().setPersistenceEnabled(true);

iOS +实时数据库

Database.database().isPersistenceEnabled = true

如果您使用的是 FireStore ,请使用以下:

If you're using FireStore then use the following:

Android:

FirebaseFirestoreSettings settings = new FirebaseFirestoreSettings.Builder()
        .setPersistenceEnabled(false)
        .build();
db.setFirestoreSettings(settings);

iOS:

let settings = FirestoreSettings()
settings.isPersistenceEnabled = false

// Any additional options
// ...

// Enable offline data persistence
let db = Firestore.firestore()
db.settings = settings

这篇关于仍在检索已删除的Firestore文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆