0

I'm buildind a program under angular7 and i'm trying to use a remote mongodb database.

In my DB.js file in the angular project, which is the file where i specify the database i want to write in, i'm using this code:

 DB: 'mongodb://192.168.1.249:27017/test'

Where 'ip address' represent the ip address of the server where my database is located. And 'test' is the name of the database.

When i start the nodemon server in order to access to mongodb after i'm having this error:

MacBook-Pro-de-mac:api mac$ nodemon server
[nodemon] 1.19.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node server.js`
Listening on port 4000
Can not connect to the databaseMongoNetworkError: connect ECONNREFUSED 192.168.1.249:27017


emeric
  • 59
  • 2
  • 11

0 Answers0