Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deleted Firestore documents still being retrieved

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

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

like image 213
Tometoyou Avatar asked Jan 29 '23 15:01

Tometoyou


1 Answers

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.

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

FirebaseDatabase.getInstance().setPersistenceEnabled(true);

iOS + Real-Time Database

Database.database().isPersistenceEnabled = true

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
like image 121
Julian Schmuckli Avatar answered Jan 31 '23 19:01

Julian Schmuckli