Reputation: 412
I try to paginate chronologically by created_at field (type of this field is timestamp), but the problem the following query with start_at return null, despite I have data after the given date (created_date).
snapshot = await FirebaseHelper.FirebaseContext.firestore()
.collection("Announcements")
.orderBy("created_at", "desc")
.startAt(1617235200000) // --> not work
.limit(3)
// .where("created_at", ">", 1617235200000) --> this not work also
.get();
With startAt result is NULL !
Without startAt I got results
From docs: https://firebase.google.com/docs/firestore/query-data/query-cursors
If I use other field for pagination (for example the ID) it works ! This reproduce just with timestamp field
Upvotes: 1
Views: 1135
Reputation: 1962
You should add an actual timestamp to your startAt
method like
startAt('1617235200000')
Upvotes: 1