Back

'DocumentList.total' and 'Queries'!

  • 0
  • Flutter
Arrow
17 Jun, 2023, 11:37

I have been paginating fetching my documents by first reading the total attribute on DocumentList . For that I put a query limit of 1 document and then use the total attribute to carry the pagination..

However, I noticed in flutter that the total attribute shows that it apparently returns the number of documents that satisfy the query, and I can confirm that it's not true. Since I can access the whole actual number of the documents using the total attribute.

In the document_list.dart file I can see the following

TypeScript
  final int total;```

So where is the catch?
TL;DR
The user is experiencing an issue with the "total" attribute in the DocumentList class. They have been using the total attribute to paginate their document fetching, but they noticed that it doesn't accurately display the number of documents that satisfy the query. They want to know if there is a catch or if they are missing something. Solution: There might be a confusion with the term "total". The "total" attribute in the DocumentList class actually refers to the total number of documents in the query result, not just the number of documents that satisfy the query. To accurately paginate the document fetching, the user should use a different approach,
Drake
17 Jun, 2023, 15:56

Are you expecting the total to be 1 because you put a limit of 1?

Arrow
17 Jun, 2023, 16:05

I'm just comparing the comment on the line of code against what actually happens, so yeah

Arrow
17 Jun, 2023, 16:06

as it seems, the limit isn't included when saying matched your query

Drake
17 Jun, 2023, 16:13

Ya, we actually mean the filter queries

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more