When you connect to MongoDB, first use Mongod.exe to start the program, then use Mongo.exe to connect to the database. However, when connecting, the error occurs: error:10061 cannot connect because the target computer is actively rejecting.
WORKAROUND: Set up the following two folders in parallel with MongoDB data and log, and then establish mongoconfig. and create a mongo.log log file under the log folder.
Later found in the configuration file, enter:
# #数据文件
Dbpath=f:\project \data
# #日志文件
Logpath=f:\project \log \mongo.log
But one thing to be aware of when setting up a configuration file is to change the extension after entering the config information in txt, if the order in turn may be wrong with the coding problem, but it doesn't matter, because Notepad error I use Notepad Plus will be garbled slightly modified on it.
After everything is done in the DOS environment, enter the path of the F:\>mongod--config Mongo.config, the return can be turned on successfully (never close the DOS window). Start the Mongo.exe program to succeed. But at the end of this is to find Mongo.exe boot, you will see the following link success prompt:
But every time it's like this. Turn on the connection advantage trouble, try to write a. bat batch file may be completed after this, expect to succeed, if successful, add in this article.
MongoDB detailed error:10061 Unable to connect because the target computer was actively rejected