Next, we will create the configuration file and update mongod alias to use the configuration file. This is how we can add admin users to the admin database and assign a role to the user. Now we will add the user admin with root role to the admin database using the commands as shown below.ĭb.createUser( ) We can see that MongoDB has already created three databases i.e. Start MongoDB server and MongoDB Shell using the aliases created by us in the previous steps. In this step, we will add the default admin user with root privileges and also enable Access Control to allow authenticated users. Save and exit the editor using the commands Ctrl + o -> Enter and Ctrl + x. Sudo mv mongosh-1.1.1-darwin-圆4 /usr/local/mongoshĪlso, add an alias by updating the ~/.zshrc as shown below.Īlias mongod="/usr/local/mongodb/bin/mongod -dbpath /System/Volumes/Data/data/db"Īlias mongo="/usr/local/mongodb/bin/mongo"Īlias mongosh="/usr/local/mongosh/bin/mongosh" Now install mongosh by following the same steps as we did for MongoDB using the commands shown below.
0 Comments
Leave a Reply. |