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
- MariaDB refuses to connect to appwrite
Earlier, I tried updating my Appwrite version from 18.1.x to the latest release because my Flutter package required it to function properly. I used the official...
- Console display all Databases as TablesD...
While looking at an issue with <@1231860789355347971> we saw that the console was displaying ALL databases as `TablesDB` even if the real type in the API is `le...
- HTTP Error 500 ''
Hello to everyone, I'm a Flutter developer and actually I'm developing an app using Appwrite.. during my tests and also massive ones I've noticed something we...