Step1:
Download the mongo db from the link
https://www.mongodb.com/try/download/community
After the successful download, install the mongodb.
“Agree” to the terms and conditions.
Click on complete and Next
Leave it as MongoDb Service.
Proceed to next and wait till the installation complete.
Final installation
Step2:
After Installation the mongo files are created in
“C:\Program Files\MongoDB\Server\4.4\bin“
Step3:
Open “CMD ” in the same folder where the mongo files are created.
Step4:
Run “mongod ” command to start the server
Step5:
Create folder as data/db in the C: drive
Then try the “mongod ” command again
Server starts running.
Step6:
Set it as environment Variable “C:\Program Files\MongoDB\Server\4.4\bin“
Run “mongodb ”
Step7:
Try to connect with mongodb compass.
Get Connected to mongodb
Step1:
Run Mongodb Server
Step2:
Run mongo client in terminal.
Step3: Create User for admin authentication
“Use admin” command to switch to admin db.
Step 4:
For creating user use the following command.
db.createUser(
{
user: "superuser",
pwd: "changeMeToAStrongPassword",
roles: [ "root" ]
}
)
Step 5:
“Show users” lists the users for db.
Step6:
Shutdown the server and restart with auth. “db.shutdownServer()”
Step7:
Run the server with authentication “mongod --auth”
Step8:
Connect client with authentication credentials
Now able to fetch datas..
Technologywe use