Setting up authorization in Windows Server
Run PowerShell as Administrator:
- Right-click on the Start icon in the lower left corner of the screen;
- Select Windows PowerShell (Administrator) from the context menu.
Connect to the MongoDB shell:
If you receive the following error after executing the connect command:
Then it means that MongoDB administration utilities are not located in the $PATH environment variable, you must search for the mongosh.exe utility to connect:
If MongoDB and the administration utilities were installed on a non-standard drive, you need to change the search path in the -Path parameter.
Once executed, the current working directory will be changed to the one where the utility is located — mongosh.exe
Connect to the MongoDB shell:
Switch to the admin database:
Create a user by changing the Login (user) and Password (pwd) of the user:
In MongoDB, you cannot use the characters .,@,$,:,%,",',/,\,| in usernames and passwords, as this can cause issues with connection of the application server to MongoDB
You need to edit the MongoDB config file to enable authorisation, run the following commands in the shell to get the location:
Edit the resulting configuration file by adding a line:
Save the changes and restart the MongoDB service in PowerShell:
To test, connect to the shell with authorisation:
You need to edit the [mongo] section of Passwork configuration file at /<passwork>/conf/keys/config.ini and specify the login and password of the created user:
Save the changes and refresh the Passwork page to test the connection with MongoDB authorisation.