how to delete document after certain time in a collection
- 0
- Self Hosted
- Flutter
- Databases
- Functions
![](https://cdn.discordapp.com/avatars/214483964356853761/cca703cd9e3f758788d2779be21098e1.webp)
how can i achieve this the best way are there any limitations?
![](https://cdn.discordapp.com/avatars/781454350114750464/2b3837afa0cce43fcb99d5da488617d6.webp)
You can mark the document that needs to be deleted and then create a function that can delete marked documents in bulk, and then schedule that function using cron: learn more about scheduling here: https://appwrite.io/docs/products/functions/execute#schedule
![](https://cdn.discordapp.com/avatars/214483964356853761/cca703cd9e3f758788d2779be21098e1.webp)
how do i mark a document?
![](https://cdn.discordapp.com/avatars/781454350114750464/2b3837afa0cce43fcb99d5da488617d6.webp)
okay, so for example create new collection called "delete-this-docs" that no one can access, and create attribute to store the document path. now you can keep adding docs here that you want to delete and then you can read this collection from Appwrite server SDK inside appwrite function, and delete all those docs from path stored and also delete record of that docs from "delete-this-docs" collection.
Learn more about server SDK here: https://appwrite.io/docs/sdks#server Learn more about function here: https://appwrite.io/docs/products/functions/functions
![](https://cdn.discordapp.com/avatars/214483964356853761/cca703cd9e3f758788d2779be21098e1.webp)
ill take a look at it thanks
![](https://cdn.discordapp.com/avatars/781454350114750464/2b3837afa0cce43fcb99d5da488617d6.webp)
edited
![](https://cdn.discordapp.com/avatars/214483964356853761/cca703cd9e3f758788d2779be21098e1.webp)
ok
![](https://cdn.discordapp.com/avatars/214483964356853761/cca703cd9e3f758788d2779be21098e1.webp)
Recommended threads
- Phone Auth
Appwrite Phone Auth: I recieve SMS after 2Minutes & sometimes it takes much time, what is the issue?
- Duplicate database for testing
Is it possible to duplicate the database to a development or acceptance database? Or do i need to do that by code?
- relationship missing data on load (key)
I have created a collection with multiple relationships, but one when I load it I don't get the field of it in my Map... Is this a bug or did I miss something? ...
![](/images/bgs/pre-footer.png)