Deleted Firestore documents still being retrieved

前端 未结 2 1705
盖世英雄少女心
盖世英雄少女心 2021-01-14 01:29

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! Th

2条回答
  •  再見小時候
    2021-01-14 01:58

    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
    

提交回复
热议问题