对于Windows安装,默认情况下必须使用exe的完整路径,除非将其添加到路径中.
要将其添加到路径,请执行以下操作:
01)
Get path to bin, something like: C:\Program Files\MongoDB\Server\4.0\bin
02)
Press the Windows key, type env
, select Edit the system environment variables
03)
On the Advanced
tab, click Environment Variables
04)
In the User variables for xxxx
section, select path
and then click the Edit...
button
05)
Click New
and paste your path with a trailing slash, eg:
C:\Program Files\MongoDB\Server\4.0\bin\
06)
Click OK
, OK
, OK
and restart your command window.
Source
您看到的示例可能是基于UNIX安装的,我认为默认情况下,它会将mongo安装为服务(Windows不会),这就是这些示例中所说的.
为了简化Windows上的启动和配置,您还可以将其作为服务安装.参见Mongo文档here和
这将允许您通过简单的呼叫启动和停止Mongo
net start MongoDB
或
net stop MongoDB