How to Access MongoDB Shell in Microsoft Windows

Posted on

Introduction

This article is focusing on describing how to access MongoDB shell. The access process is involving the shell execution. The shell in this article’s context is the shell available in Microsoft Windows. So, in order to access the shell, there are several pre-requirements that must be available. First of all, the MongoDB installation is available and the service is running.

As an additional reference, check this article with the title of ‘How to Perform MongoDB Offline Installation in Microsoft Windows 10’ for the MongoDB installation description in this link. Furthermore, in order to start the MongoDB service, just read the article with the title of ‘How to Start MongoDB Service in Microsoft Windows’ in this link.

MongoDB Shell Access

The following are the steps to access the MongoDB shell :

1. So, in order to access the MongoDB shell, just access the Windows Command Prompt Console. Start by executing it through the field ‘Type here to search’ as in the image as follow :

How to Access MongoDB Shell in Microsoft Windows
  1. Type ‘command’ in that field above as follows :
How to Access MongoDB Shell in Microsoft Windows
  1. Just click it, or right click at the Command Prompt and then select the Run as administrator. So, the command prompt will appear as follows :
How to Access MongoDB Shell in Microsoft Windows
  1. The above Windows Command Prompt appear in the ‘C:\Windows\system32’ as the current working directory. The reason is because the command prompt is running with the Administrator account privilege. In order to access the MongoDB shell, just type ‘mongo’ as follows :
How to Access MongoDB Shell in Microsoft Windows

The above image is displaying the actual process for executing the MongoDB shell. Just by typing the ‘mongo’ command, the command will direct it to the MongoDB shell. But the command is available only in the binary folder of the MongoDB folder installation. So, in order for the command to be available in all folder directory or path, just add it in the environment variable of the Microsoft Windows operating system.

Leave a Reply