How to use Mongo shell in windows system

Deepak Singh Rajput
3 min readJun 28, 2021

--

Creating a new cluster on MongoDB atlas

  • First you need MongoDB atlas account to create new cluster. So you have go to MongoDB official website.
The most popular database for modern apps | MongoDB
  • If you already have account you can skip this step else Click on try free and create a new account.
  • Then you have to mention your organization name, project name and preferred language or you can skip it.
  • Then it will ask you type of cluster you want to create. Here we are going to use Free cluster. So click on Create free cluster. It provides us
    M0 Sandbox (Shared RAM, 512 MB Storage)
Cluster Plans
  • Then you have to select cloud provider and region you want by default they are selected as AWS and North Virginia and then click on create cluster.
Create a shared cluster
  • Then you have to mention :
  1. how would you like to authenticate your connection using username and password by creating a user or by certificate

2. from where would you like to connect to cluster.

3. IP addresses you want to access your clusters.

  • After this just wait for few seconds until your clusters are deployed on cloud.
Cluster0

Using Mongo shell in windows system

  • On Clusters page click on Connect button.
  • You have to select how you would like to connect to your clusters by mongo shell in your local system, in your application, or using MongoDB compass. Here will be using Mongo shell so select Connect with Mongo Shell
  • Then you have to select your OS, click on download mongo shell.
  • Unzip the downloaded file which would be named like mongodb-shell-windows-x86_64–4.4.6.zip
  • Move the unzipped folder to your preferred location whether in ‘C drive’ or any other location and copy the location path.
  • Now open the control panel and navigate to the following path: Control Panel\System and Security\System
  • Click the “Advanced System Settings”
  • In the next dialog, you will see the Environment Variables button in the bottom of the Advanced tab.
  • The Environment Variables window will appear on the screen.
  • Click on path and then click new and paste the copied path of mongo shell.
  • Now open command prompt and type mongo.

as we haven’t entered command to connect with our cluster that’s why its giving error but mongo shell is working now.

If you want to know more about MongoDB visit here

--

--

Deepak Singh Rajput

I’m a software developer working on spring boot and microservices.