After I have started Mongo using mongod.exe on a Windows 7 machine, I tried to start the mongo shell that failed with the error:
Failed to connect to
I found my answer on this page. https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mongo-app?view=aspnetcore-3.1&tabs=visual-studio So, first, make a folder for your data; then, open one command shell
mongod --dbpath <data_directory_path>
then, open another shell, do whatever you want to do. You can see in MongoDB Compass, there are collections if you had one before.
In Windows 10: Executing below command restarts mongodb service (as administrator), required if there is a system restart after mongodb installation.
net start mongodb
Also make sure to check, if there is a MongoDBInstallation folder/data and /data/db folder created, same can be obtained at MongoDBInstallation\bin\mongod.cfg
mongod --dbpath=c:\MongoDBInstallation\data\db