All Products
Search
Document Center

ApsaraDB for MongoDB:How do I install and use the mongo shell in a Windows operating system?

Last Updated:Jul 05, 2023

The mongo shell is a client tool that is used to connect to open source MongoDB databases and ApsaraDB for MongoDB instances. This topic describes how to install and use the mongo shell in a Windows operating system.

Install the mongo shell

  1. Go to the MongoDB Community Server Download page.

  2. Select the version, platform, and package of the mongo shell that you want to install, and then click Download.

    Note
    • In this example, the version is 4.0.28, the platform is Windows, and the package is msi.

    • To make sure that the client can be authenticated when you connect to an ApsaraDB for MongoDB instance, select MongoDB 3.0 or later.

  3. Double-click the downloaded package and then click Next.mongosh-安装1..png

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

    安装Mongo Shell
  5. Click Custom.Mongo Shell自定义安装

  6. Select only Client and then click Next.选择Client

  7. Determine whether to select Install MongoDB Compass, and then click Next. In this example, MongoDB Compass is not installed. Mongosh安装5..png

  8. Click Install.mongosh安装-6..png

  9. After the application is installed, click Finish .

Use the mongo shell

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

Example:

cd C:\Program Files\MongoDB\Server\4.0\bin
Note

After you go to the directory in which mongo.exe is stored, you can use the mongo shell.

References

Connect to a replica set instance