Back

Delete Document Created By User

  • 0
  • Users
dammy
8 Aug, 2023, 07:35

How do I auto delete all documents created by user or any appwrite available api for that?

TL;DR
To delete all documents created by a user, you need to keep track of the user's documents and store their ID or a reference. Then, set up a scheduled task or background job to run at specific intervals or use a loop. Within this task, fetch the list of documents associated with the user and delete them one by one using the Appwrite API's "databasesDeleteDocument" method. If you'd like to have the option for bulk delete operations, you can upvote the feature request here: https://github.com/appwrite/appwrite/issues/3520
joeyouss
8 Aug, 2023, 09:35
  • You need to keep track of the user's documents, which might involve storing the user's ID or a reference to their documents.
  • Set up a scheduled task or a background job that runs at specific intervals (e.g., daily or weekly) or maybe use a loop if there is no need for schedules. This task will fetch the list of documents associated with the user and delete them.
  • Using https://appwrite.io/docs/client/databases?sdk=web-default#databasesDeleteDocument, you can delete them one by one

Please upvote this if you would like to see bulk delete operations: https://github.com/appwrite/appwrite/issues/3520

dammy
9 Aug, 2023, 16:46

Okay @joeyouss

I'll check that out I appreciate you dearly

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