Working with mongo shell
Prerequisite : Visit my blogs Install Run and Connect to MongoDB on Mac OR Install Run and Connect to MongoDB on Windows Create mongo database and user After connecting to mongo shell using the command " $ mongo" , follow the below instructions to create mongo database and user. Show all databases Print a list of all databases on the server. > show dbs Output : admin 0.000GB config 0.000GB local 0.000GB To display the database you are using, type db : The operation should return ‘test’, which is the default database. > db Output : test S witch databases To switch databases, type the ‘use <db>’ helper: > use test Output : switched to db test Create Admin user with access to any database > use admin Output : switched to db admin > db Output : admin Create Admin user . > db.createUser({user:"admin",pwd:"admin",roles:[{role:"userAdminAnyDatabase",db:" admin"},"re...