Skip to content

Instantly share code, notes, and snippets.

@AmShaegar13
AmShaegar13 / outdated_files_query.js
Last active April 17, 2024 15:34
Delete outdated files from Rocket.Chat
/**
* MongoDB query to delete outdated files from Rocket.Chat. You can specify the number of DAYS
* before a file is considered outdated. Deleted files are removed from GridFS completely keeping
* only the message in chat. The message is modified to be a link that points to ALT_LINK instead
* of the file and '(deleted)' is appended to the title.
*
* Tested with MongoDB 3.4
*/
const DAYS = 60;