
Hello everybody !
I insert data into a collection with the Nodejs sdk, in total I have 6250 records to do. The data is added to the collection well (I have a progress bar and the insertion goes to 6250), I have no error message and the program terminates. But the collection stops at 5000 records. Is there a limit of documents in a collection please?
thank you for help.

I have just checked, indeed in the "Documents" tab in the collection , it displays 12 lines of 417 pages maximum which makes 5004 records and displays at the bottom left "total results": 5000 , when we go to the "Usage" tab shows me 6257 documents

Another problem is when I use the List Documents api "databases.list_documents('[DATABASE_ID]', '[COLLECTION_ID]')" , it returns me "total results: 5000". and the list of documents.
I want to check the number of documents in the list to see if there were 5000 or 6257 but this one only returns me 25 documents? Why ?

You can have more documents, we just show you 5000+ instead of the exact number.

The count operation in SQL will iterate over every single document

And counting all the time is terrible for performance. That said, if you need to keep track of number of documents, we recommend you actually have a separate "count" collection that you can use.

You can either have every document create and delete operation trigger an Appwrite function to increment or decrement a counter, or to pass all document operations through an Appwrite function to do the same type of operation.

This way you will have O(1) time checking number of documents, instead of O(N)

Thank you Vincent, indeed I am a beginner and it seems strange to me. I didn't know if I could access a maximum of 5000 documents. In any case, the remaining 1257 are, that's what matters to me. Thanks for the increment idea !

We also recommend you do Cursor pagination for the same reason, so you don't rely on count. This is what GitHub does, too. https://appwrite.io/docs/pagination#cursor-pagination

Yeah great ! Thank you so much Vincent !

[SOLVED] The maximum document in the collection is 5000?
Recommended threads
- Bug: When creating a table, table name i...
I created a table with a typo. my_taable .... then my code couldn't find it. i updated table name and still couldn't find it. the table name doesn't update. i h...
- unexpected row_invalid_structure error
In images you can see both my code,error, column schema I do have timezone in table schema but still while creating a row i am receving row_invalid_structure e...
- Internal 500 Server Error
I don't have much information but I am unable to create anything on database, Auth users are creating but not able to fetch into database
