The mongo shell allows you to connect to both MongoDB and ApsaraDB for MongoDB. This article describes how to install and use the Mongo shell in a Windows operating system.


Alibaba Cloud reminds you that:

  • Before you perform operations that may cause risks, such as modifying instance configurations or data, we recommend that you check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
  • You can modify the configurations and data of instances including but not limited to Elastic Compute Service (ECS) and Relational Database Service (RDS) instances. Before the modification, we recommend that you create snapshots or enable RDS log backup.
  • If you have authorized or submitted sensitive information such as the logon account and password in the Alibaba Cloud Management Console, we recommend that you modify such information in a timely manner.

Install the mongo shell

  1. Visit the MongoDB downloading center.
  2. In Version from the region drop-down list, select the MongoDB version to be installed, and then click Download.
    Instructions to be authenticated when you connect to an apsaradb for MongoDB instance, install MongoDB 3.0 or later.
  3. Double-click the downloaded software package to start the installation.
  4. Select the check box as prompted. I accept the terms in the License Agreement, click Next.
  5. Click Custom perform a custom installation.
  6. Click Custom Install and select install Client and click Next.
  7. Wait until the mongo shell is installed.

Use the Mongo Shell

  1. Log on to the Windows system and choose run window, input cmd, click confirm, and then open the command line tool.
  2. Run the following command to go to the directory where the mongo.exe program is located.
    cd C:\Program Files\MongoDB\Server\4.0\bin
    • Mongo.exe applications of different versions are located in different directories. Refer to the on-site environment.
    • After entering the directory of mongo.exe, you can use the Mongo Shell.


Application scope

  • ApsaraDB for MongoDB