Error: could’t connect to server 127.0.0.1:27017 Src / Mongo / shell/ mongo.js

A. check whether the service is started first. If the service is not started, start the service first: Net stat mongodb

B. if the service has been started, it may be that Mongo was shut down abnormally last time, resulting in the file storing data being occupied and locked. Just add the mongod.lock The file is deleted. Restart the service net stat mongodb.

Read More: