Mongodb: failed to connect to server on first connect

前端 未结 13 2972
陌清茗
陌清茗 2020-12-15 15:52

I get the following error:

Warning { MongoError: failed to connect to server [mongodb:27017] on first connect
    at Pool. (/Users/michaelks         


        
相关标签:
13条回答
  • 2020-12-15 16:19

    Local MongoDb problem solution

    solve it by following the below steps:

    Changed

    mongodb://localhost:27017/local
    

    to

    localhost/local
    

    And the error gone

    0 讨论(0)
  • 2020-12-15 16:21

    In case of remote db in cloud such as ATLAS, you should create whitelist entry 0.0.0.0/0. This allows you to access your cluster ATLAS from any IP address.

    0 讨论(0)
  • 2020-12-15 16:22

    I was getting same error while I tried to connect mlab db that is because my organization network has some restriction, I switched to mobile hotspot and it worked.

    0 讨论(0)
  • 2020-12-15 16:22

    I ran into this issue serval times, and here is some troubleshooting list

    1. make sure database path is exist, the default path in windows in C:\data\db
    2. make sure mongo is running, to run it go to C:\Program Files\MongoDB\Server\3.4\bin and run the following:
      1. mongod.exe
      2. mongo.exe
    3. make sure that your connection string is correct like mongodb://localhost/database-name
    0 讨论(0)
  • 2020-12-15 16:24

    I connected to a VPN and it worked. I was using school's WiFi.

    0 讨论(0)
  • 2020-12-15 16:26

    For me,issue was mongo was not running.So first i started "mongod" command in the console.And later in another console tab I have run "mongo". Now the connection is successful. Now run your app your problem should be solved.

    0 讨论(0)
提交回复
热议问题