MongoNetworkError: failed to connect to server [localhost:27017] on first connect [Error: connect EC

Mongodb is installed, but the MongoDB server is not started.
Step 1: Open CMD and enter the MongoDB bin directory

Step 2: Enter the instruction: MonGod — dbPATH database path
If successful, it will be shown as follows:

Step 3: Leave the window open and open another CMD
Enter the bin directory of MongoDB again and enter Mongo, which is shown as follows:

 
 
Finally, you can run mongo on the console. Such as:

Read More: