Mark All Rocket.Chat Rooms Read-only and Archive Them

Here's how to set all rooms in Rocket.Chat to read-only and archive them. This can be useful if you wish to keep chat history for historical purposes.

Are you switching away from Rocket.Chat but wish to keep chat history for a period of time for historical purposes?  Unfortunately, Rocket.Chat does not have a 'mark entire site as read-only' button at the moment (v0.69.2).  Instead, here's how to make all rooms read-only and archive them with a couple MongoDB queries.

Environment: Rocket.Chat v0.69.2

First, open a shell to your MongoDB instance.  Once logged in, execute the following queries:

# Archive all rooms
db.getCollection('rocketchat_room').update({}, {$set: {'archived':'true'}}, {multi: true})

# Mark all rooms as read-only
db.getCollection('rocketchat_room').update({}, {$set: {'ro':'true'}}, {multi: true})

Now that we have performed those queries, don't forget to update permissions (Administration > Permissions) and revoke the following permissions from users:

  • Create Public Channels
  • Create Direct Messages
  • Create Private Channels

And that's it!  You now have a somewhat read-only instance of Rocket.Chat!  Keep in mind that admin users will still be able to post in read-only channels.