Abhishek A Udupa
Abhishek A Udupa

Reputation: 432

Firestore data retrieval of non-existing documents

I want to use the following code to get data from firestore that is sorted according to the date the document was updated on:

fun getQuery(groupID: String): Query {
        val path = FirestorePath()
        return path.getTaskCollectionRef()
            .orderBy(ActionTask.FieldNames.taskUpdatedOn.name, Query.Direction.DESCENDING)
            .whereEqualTo(ActionTask.FieldNames.taskGroupID.name, groupID)
            .whereEqualTo(ActionTask.FieldNames.taskOpen.name, true)
    }

The problem is that the .orderBy() causes my app to display data from documents that are deleted (existed previously, now deleted).

When I remove the .orderBy(), I see the correct data in my app.

Upvotes: 0

Views: 110

Answers (1)

rsalinas
rsalinas

Reputation: 1537

This is due to the offline mode of Firestore being active by default in your code. You should turn if off in order to avoid getting responses from the cache instead of your database.

You can find more information about the offline mode and how to disable it for Android over at this document

Hope you find this useful!

Upvotes: 1

Related Questions