Unable to connect to mongodb Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:L112

后端 未结 17 992
不知归路
不知归路 2021-02-02 14:45

When ever I try to connect to mongo db I always get this error as below.

MongoDB shell version: 2.4.3 connecting to: test Fri Apr 26 14:31:46.941 JavaScript execution f

17条回答
  •  滥情空心
    2021-02-02 15:20

    If any one is facing the problem in windows machine then follow the steps.

    1. Add the path of mongodb in the environmental variable.
    2. Create a directory C:\Data\db.
    3. Open a terminal(cmd) and write mongod. (it will initiate the server).
    4. Open another terminal and write your own code.

提交回复
热议问题