When i'm deleting users from MongoDB manually, the number of users on the channel remains the same

  • Version of Rocket.Chat Server: 0.69.1
  • Operating System: Debian 8
  • Deployment Method: tar
  • Number of Running Instances: 1
  • DB Replicaset Oplog: -
  • NodeJS Version: 8.11.3 - x64
  • MongoDB Version: 3.2.21

I needed to remove several users from the RocketChat manually, i.e. not using the RC capabilities. In MondoDB I found these users, their direct messages and deleted them. There are no users anymore, there are no direct messages, everything is ok. But in the channel users list there is an incorrect number of users. That is, users 12 (plus switched off “rocket.cat”, but shown are 16 (as it was before, before removal).
How to fix this?

This is the number of users in the settings:
2018 09 11-12-39-55

This is the number of users in the channel userlist:
2018 09 11-12-40-46


This is why when ever asked, we would always recommend against touching the data directly in the database.

Users have subscriptions to channels you would have to remove their subscriptions as well. There is a number of other collections that would have orphaned data also.

Please use our api to delete users instead. Its much safer


In general, as administrator of ANY web application using a database - writes and deletes DIRECTLY on the database without the application’s knowledge is suicidal to the application’s health.

Many applications can become permanently damaged with a corrupted database in irrecoverable state.

Direct DB reads and copies are generally safe, but still should be kept to a “as-needed” minimum. On a heavily loaded system, even reads and copy can affect regular operations.