下载&安装

下载

MongoDB官网下载页面

https://www.mongodb.com/try/download/community

Windows 4.4.4下载链接

https://fastdl.mongodb.org/windows/mongodb-windows-x86_64-4.4.4-signed.msi

安装

image-20210223165011681

image-20210223165032278

  • 这一步选custom只是为了下一步可以选择安装位置

image-20210223165103534

image-20210223165201144

  • 把mongo安装成服务

image-20210223165250254

  • 这一步会安装mongo自己的可视化工具,不是特别建议因为会很慢可以后期去官网下载

    image-20210223165505662

    image-20210223165600390

    等待安装完成即可,Windows在这一步可能会有报错,至少我就没顺利过,具体问题参考踩坑填坑

踩坑填坑

Service MongoDB Server MongoDB failed to start. Verify that you have sufficient privileges to start system services

image-20210223165727751

当遇到这个问题,直接点ignore忽略就好,当然不是不解决这个问题,因为你的服务依旧没有正常启动

image-20210223170244212

手动启动会报错

image-20210223170319470

去安装目录的bin目录下执行 mongod --install

1
2
3
4
5
PS D:\MongoDB\Server\4.4\bin> mongod --install
{"t":{"$date":"2021-02-23T17:05:24.561+08:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2021-02-23T17:05:24.565+08:00"},"s":"W", "c":"ASIO", "id":22601, "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2021-02-23T17:05:24.565+08:00"},"s":"I", "c":"NETWORK", "id":4648602, "ctx":"main","msg":"Implicit TCP FastOpen in use."}
{"t":{"$date":"2021-02-23T17:05:24.566+08:00"},"s":"I", "c":"CONTROL", "id":23288, "ctx":"main","msg":"--install has to be used with a log file for server output"}

分析输出error 最终的关键信息是第三行的

No TransportLayer configured during NetworkInterface startup

通过这行报错找到了这个这个的解决方案

what is meant by this error “No TransportLayer configured during NetworkInterface startup” in mongodb?

解决方案是回到服务列表右键属性切换到登录标签,将登录身份更改为本地系统账户,确定后重启服务就可以正常启动了

image-20210223171217974

用户这里正常来说应该在安装的这一步可以选择第二项进行选择用户,但是会有问题,指定用户为Administrator后点击下一步安装程序就会直接结束 也是因为发生了异常

image-20210223165250254

可视化工具

MongoDB Compass

image-20210223174731738

image-20210223174805746

DataGrip

image-20210223174937225

对于简单的查询和聚合用datagrip还比较好

因为查询支持select语句,同时会在输出力转化为对应的语法

image-20210223175104350