Connect node app running in docker to mongodb community instance running locally

Viewed 23

I have a node app running as a docker container, previously before I containerised the node app I accessed mongodb instance like this mongodb://localhost:27017/<dbname>?authSource=admin&directConnection=true. I had tried the same but it failed hence tried this mongodb://host.docker.internal:27017/<dbname>?authSource=admin&directConnection=true which is still failing with the error

Database error. error code: unknown, error message: Server selection timeout: No available servers. Topology: { Type: Single, Servers: [ { Address: localhost:27017, Type: Unknown, Error: Cannot assign requested address (os error 99) }, ] }
0 Answers
Related