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

Install the mongo shell

  1. Visit the MongoDB downloading center.
  2. From the Version drop-down list, select the target MongoDB version.MongoDB downloading center
    Note To be authenticated when you connect to an ApsaraDB for MongoDB instance, select MongoDB 3.0 or later.
  3. Double-click the downloaded software package to start the installation.

    Select I accept the terms in the License Agreement and click Next.

    Install the mongo shell
  4. Click Custom.Customized mongo shell installation
  5. Only select Client and click Next.Select Client
  6. Wait until the mongo shell is installed.

Use the mongo shell

Open the command prompt window and go to the directory where the mongo.exe program is stored.

Example:

cd C:\Program Files\MongoDB\Server\4.0\bin
Note After you open the directory of mongo.exe, you can use the mongo shell.

References

Overview of replica set instance connections