MongoNetworkError: failed to connect to server [localhost:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017]

前端 未结 26 2617
轻奢々
轻奢々 2020-11-30 04:34

I\'m new in nodeJS, started learning by following a trailer on youtube, everything goes well until I added the connect function if mongodb,

mongo.connect(\"m         


        
相关标签:
26条回答
  • 2020-11-30 05:22

    first create folder by command line mkdir C:\data\db (This is for database) then run command mongod --port 27018 by one command prompt(administration mode)- you can give name port number as your wish

    0 讨论(0)
  • 2020-11-30 05:22

    My case was a little different. After restarting my system, I had not whitelisted my IP address on Mongo while doing local development.

    Select Network Access > Add IP Address > Add your current IP Address
    
    0 讨论(0)
提交回复
热议问题