Solve the problem:
Configure environment variables about MongoDB
D:\mongdb\bin
1. Use management to open cmd (run as an administrator)
2.输入下面指令删除MongoDB服务器
sc delete MongoDB
3. Create a new data folder, which contains the db and logs folders, in which a new MongoDB.log file needs to be created in the logs
4.然后继续在cmd里面输入下面指令(PS:你们换一下路径就OK了)
mongod --dbpath=E:\MongoDB\data\db --logpath=E:\MongoDB\data\logs\MongoDB.log --install --serviceName "MongoDB"
5. Go to the service to start MongoDB
6. Then we can see that there is content in the data file.
Reference blog https://www.cnblogs.com/huangkecheng/p/10909040.html