Remove all users from DB

I need to deleted all users from the db. I had my ldap base set wrong and imported all groups, computers, and users.
I would like to drop all and resync with the correct base

Server Setup Information

  • Version of Rocket.Chat Server: 2.4.11
  • Operating System: Ubuntu 18.04
  • Deployment Method: Snap
  • Number of Running Instances: 1
  • DB Replicaset Oplog:
  • NodeJS Version: 8.17.0
  • MongoDB Version: 3.6.14
  • Proxy: none
  • Firewalls involved: none

I found this somewhre in the Internet and used this often…
bash: mongo

use rocketchat
db.users.remove({“ldap”: true});

Thank you very much. unfortunately, I found that and tried it.
I get the following message: WriteResult ({“nRemoved” : 0 })
and the users still exist

Hm, and the user are imported via LDAP? I have had no problems with this command. In this case I can not help you, I do not know the database structure nor mongodb commands.

Yes sir. That is correct they were syncd to active directory.
Unfortunately, I do not know mongodb commands either.
I tried to look at a tutorial but didn’t make much head way
with it. Makes me miss mysql.

I figured it out.
I had to do the following
use parties
db.users.remove({“ldap”:true});

using the parties collection was the key for me

Thanks for your help!

The comand have error db.users.remove ({“ldap”: true}); corect version db.users.remove ({“ldap”: true});