Database
...
MongoDB
Examples of authorization sett...
Setting up authorization in Windows Server
11min
connect and create a user in mongodb connecting to shell 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 mongosh shell connection error if you receive the following error after executing the connect command mongosh the term 'mongosh' is not recognized as the name of a cmdlet, function, script file, or operable program 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 $mongoshpath = get childitem path "c \\" filter "mongosh exe" recurse erroraction silentlycontinue | select object first 1; $mongoshdirectory = $mongoshpath directoryname; cd $mongoshdirectory 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 \mongosh exe creating a user switch to the admin database use admin create a user by changing the login (user) and password (pwd) of the user db createuser({ user "adminuser", pwd "password", roles \[ { role "root", db "admin" } ], passworddigestor "server" }) in mongodb, you cannot use the characters , @ , $ , , % , " , ' , / , \ , | in usernames and passwords, as this can cause issues with connection of the application server to mongodb enable authorisation and connect passwork enabling authorisation in mongodb you need to edit the mongodb config file to enable authorisation, run the following commands in the shell to get the location var cmdlineopts = db servercmdlineopts(); print("config " + cmdlineopts parsed config); edit the resulting configuration file by adding a line security authorization enabled save the changes and restart the mongodb service in powershell net stop mongodb net start mongodb to test, connect to the shell with authorisation mongosh "mongodb //adminuser\ password\@localhost 27017" setting up and connecting passwork with authorization you need to edit the passwork configuration file at c \inetpub\wwwroot\passwork\init\config env and specify the login and password of the created user mongodb username=adminuser mongodb password=password save the changes and refresh the passwork page to test the connection with mongodb authorisation