msiexec.exe
This section describes how to install 本节介绍如何通过MSI安装程序在Windows上安装mongosh on Windows through the MSI installer.mongosh。
If you already have 如果您已经安装了mongosh installed and want to upgrade to the latest version, see Upgrade mongosh.mongosh并希望升级到最新版本,请参阅升级mongosh。
Prerequisites先决条件
To use the MongoDB Shell, you must have a MongoDB deployment to connect to.要使用MongoDB Shell,您必须有一个MongoDB部署才能连接。
For a free cloud-hosted deployment, you can use MongoDB Atlas.对于免费的云托管部署,您可以使用MongoDB Atlas。To learn how to run a local MongoDB deployment, see Install MongoDB.要了解如何运行本地MongoDB部署,请参阅安装MongoDB。
Supported MongoDB Versions支持的MongoDB版本
You can use the MongoDB Shell to connect to MongoDB version 7.0 or greater.您可以使用MongoDB Shell连接到MongoDB 7.0或更高版本。
Supported Operating Systems支持的操作系统
You can install MongoDB Shell on these Windows operating systems:您可以在以下Windows操作系统上安装MongoDB Shell:
- Microsoft Windows Server 2016+
- Microsoft Windows 10+
Procedure过程
Note
On Windows, 在Windows上,mongosh preferences and configuration options are stored in the %APPDATA%/mongodb/mongosh directory.mongosh首选项和配置选项存储在%APPDATA%/mongodb/mongosh目录中。
Open the MongoDB Shell download page.打开MongoDB Shell下载页面。
Open the MongoDB Download Center.打开MongoDB下载中心。
Zip File
This section describes how to install 本节介绍如何通过mongosh on Windows through the .zip archive..zip存档在Windows上安装mongosh。
If you already have 如果您已经安装了mongosh installed and want to upgrade to the latest version, see Upgrade mongosh.mongosh并希望升级到最新版本,请参阅升级mongosh。
Prerequisites先决条件
To use the MongoDB Shell, you must have a MongoDB deployment to connect to.要使用MongoDB Shell,您必须有一个MongoDB部署才能连接。
For a free cloud-hosted deployment, you can use MongoDB Atlas.对于免费的云托管部署,您可以使用MongoDB Atlas。To learn how to run a local MongoDB deployment, see Install MongoDB.要了解如何运行本地MongoDB部署,请参阅安装MongoDB。
Supported MongoDB Versions支持的MongoDB版本
You can use the MongoDB Shell to connect to MongoDB version 7.0 or greater.您可以使用MongoDB Shell连接到MongoDB 7.0或更高版本。
Supported Operating Systems支持的操作系统
You can install MongoDB Shell on these Windows operating systems:您可以在以下Windows操作系统上安装MongoDB Shell:
- Microsoft Windows Server 2016+
- Microsoft Windows 10+
Procedure过程
Note
On Windows, 在Windows上,mongosh preferences and configuration options are stored in the %APPDATA%/mongodb/mongosh directory.mongosh首选项和配置选项存储在%APPDATA%/mongodb/mongosh目录中。
Open the MongoDB Shell download page.打开MongoDB Shell下载页面。
Open the MongoDB Download Center.打开MongoDB下载中心。
Download the mongosh installation archive for your operating system.下载适用于您操作系统的mongosh安装存档。
Download 从MongoDB下载中心下载mongosh from the MongoDB Download Center.mongosh。
Extract the files from the downloaded archive.从下载的存档中提取文件。
Open a 打开cmd terminal and run the following command from the directory that has the mongosh .zip archive:cmd终端,从包含mongosh .zip存档的目录中运行以下命令:
tar -xf mongosh-2.5.10-win32-x64.zip
The extracted archive has a 提取的存档有一个bin folder that contains two files, mongosh.exe and mongosh_crypt_v1.dll.bin文件夹,其中包含两个文件mongosh.exe和mongosh_crypt_v1.dll。
Add the mongosh binary to your PATH environment variable.将mongosh二进制文件添加到PATH环境变量中。
Ensure that the extracted MongoDB Shell binary is in the desired location in your filesystem, then add that location to your 确保提取的MongoDB Shell二进制文件位于文件系统中的所需位置,然后将该位置添加到PATH environment variable.PATH环境变量中。
To add the MongoDB Shell binary's location to your 要将MongoDB Shell二进制文件的位置添加到PATH environment variable:PATH环境变量中:
Open the Control Panel.打开“控制面板”。In the System and Security category, click System.在“系统和安全”类别中,单击“系统”。Click Advanced system settings. The System Properties modal displays.单击“高级系统设置”。“系统属性”模式显示。Click Environment Variables.单击“环境变量”。In the System variables section, select在“系统变量”部分,选择“路径”并单击“编辑”。将显示“编辑环境变量”模式。Pathand click Edit. The Edit environment variable modal displays.Click New and add the filepath to your单击“新建”并将文件路径添加到mongoshbinary.mongosh二进制文件中。Click OK to confirm your changes. On each other modal, click OK to confirm your changes.单击“确定”确认更改。在其他模式中,单击“确定”以确认更改。
To confirm that your 要确认PATH environment variable is correctly configured to find mongosh, open a command prompt and enter the mongosh --help command. PATH环境变量已正确配置为查找mongosh,请打开命令提示符并输入mongosh --help命令。If your 如果PATH is configured correctly, a list of valid commands displays.PATH配置正确,将显示有效命令列表。
Next Steps后续步骤
After you successfully install 成功安装mongosh, learn how to connect to your MongoDB deployment.mongosh后,学习如何连接到MongoDB部署。
MongoDB provides a programmatically accessible list of MongoDB提供了一个可编程访问的mongosh downloads that can be accessed through your application.mongosh下载列表,可以通过应用程序访问。