Enabling Security on a MongoDB Installation for CleanMyOrg

NOTE: If you are running Admin Tools on the same server, this workflow may cause issues with the application unless you also follow the instructions for the relevant workflow for Admin Tools.


  1. In Command Prompt, navigate to the MongoDB installation directory with mongo.exe, the default is
    cd /D “C:\Program Files\MongoDB\Server\4.0“

  2. Type mongo from this directory in the command prompt to start the mongo shell. (Note: if you are already using authentication with mongo, you will need to log in with administrator credentials.)

  3. Type:
    use CleanMyOrg

  4. Copy and paste in the following lines, changing yourusername and yourpassword to the desired values:
    db.createUser({"user": "yourusername", "pwd":"yourpassword","roles":[{ "role": "dbOwner", "db":"CleanMyOrg"}]})
    db.grantRolesToUser("yourusername", [ { role: "readWrite", db: "CleanMyOrg" } ])


    1. Note: If you are editing Admin Tools permissions at the same time, you can paste the following line as well:
      db.createUser({"user": "admintoolsdb", "pwd":"yourpassword", “roles”: [{ role: "dbAdmin", db: "geojobe_admintools" }]})
      db.grantRolesToUser("admintoolsdb", [ { role: "readWrite", db: "geojobe_admintools" } ])


  5. Type exit to leave the mongo shell.

  6. To enable mongoDB with authentication, edit the file in the default mongo installation directory C:\Program Files\MongoDB\Server\4.0\mongod.cfg

  7. Find the line starting with #security and paste the following lines underneath:
    security:
        authorization: enabled

  8. Save the file and close.

  9. In the CleanMyOrg directory, edit the file called: C:\CleanMyOrg\config\nodeConfig.json

  10. Edit the “url” line of “mongoDB” to read:
    "url": "mongodb://yourusername:yourpassword@localhost:27017/CleanMyOrg",

  11. Save the file and close.

  12. Open Windows Services and restart the “MongoDB Server” windows service.

  13. Restart the “CleanMyOrg Server” windows service.