microsoft / TypeScript-Node-Starter

A reference example for TypeScript and Node with a detailed README describing how to use the two together.
MIT License
11.29k stars 2.76k forks source link

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

Closed mozgbrasil closed 2 years ago

mozgbrasil commented 2 years ago

Good morning my friends

I have your project implemented in

https://acid-express-labs-ts.herokuapp.com/

Which returns the error "MongoNetworkError: failed to connect to server [localhost:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017"

two.

I have the express.js project implemented in

https://acid-express-labs.herokuapp.com/airbnb

That we see how MongoDB Cloud data return works

Captura de tela de 2021-08-04 12-45-20

Both projects use the same MongoDB Cloud connection variable

I appreciate if you can help me

mozgbrasil commented 2 years ago

I was using a variable

NODE_ENV = stagging

I changed to

NODE_ENV = development

Now you get the error "MongoError: cannot do raw queries on admin in atlas"

I also changed the connection variable pointing to the database