Back

Total documents stuck at 5000

  • 0
  • Self Hosted
  • General
rohan
17 Jul, 2023, 04:44

Hi, i came across this issue.. https://github.com/appwrite/appwrite/issues/5506

Why cant we have a count variable for every collection in the database? increment it on every document created and decrement on every document deleted.

by this way the "expensive database operation" on count will also be reduced and we will get the exact count of every documents inside the collection.

TL;DR
Some users are discussing the issue of documents getting stuck at 5000. One user suggests implementing a metadata collection to maintain an accurate count of documents. They recommend using custom functions triggered on document creation and update events. Another user mentions a feature request on GitHub that could potentially make this easier in the future. There is also mention of an option to embed this count variable in the collection, although the exact location is not found. One user suggests implementing a count variable for every collection and incrementing it on document creation and decrementing it on document deletion to reduce the expensive database operation on count.
rohan
17 Jul, 2023, 04:56

probably its not suitable for filterQueries but at least we will get an idea on how much documents exists in the collection

Binyamin
17 Jul, 2023, 12:16

The first solution would be to indeed create some counter, and you can let to be trigger on

  • databases.*.collections.*.documents.*.create
  • databases.*.collections.*.documents.*.update So you can be sure the counter will be up to date.

Also these feature request https://github.com/appwrite/appwrite/issues/3905 will make it easy in the future.

Also, I remember seeing somewhere the option to have this option embed in the collectin but can seem to find it right now.

Drake
22 Jul, 2023, 20:53

right. we recommend having that sort of metadata collection if you need to maintain a count of documents.

rohan
23 Jul, 2023, 04:33

How to implement that?

Drake
23 Jul, 2023, 04:36

Want to take a guess?

rohan
23 Jul, 2023, 04:36

Custom functions?

rohan
23 Jul, 2023, 04:37

But it would be good if it was implemented directly with appwrite

Drake
23 Jul, 2023, 04:42

I don't think so because it's custom app logic and only for some apps

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