Error connect to mongo in docker
rdeputat opened this issue · comments
$ yarn start
yarn run v1.3.2
$ node dist/index.js
{ MongoError: failed to connect to server [localhost:27017] on first connect
at Pool. (/Users/romandeputat/Projects/Test/GraphQL/graphql-mongo/node_modules/mongodb-core/lib/topologies/server.js:326:35)
at Pool.emit (events.js:160:13)
at Connection. (/Users/romandeputat/Projects/Test/GraphQL/graphql-mongo/node_modules/mongodb-core/lib/connection/pool.js:270:12)
at Object.onceWrapper (events.js:255:19)
at Connection.emit (events.js:160:13)
at Socket. (/Users/romandeputat/Projects/Test/GraphQL/graphql-mongo/node_modules/mongodb-core/lib/connection/connection.js:175:49)
at Object.onceWrapper (events.js:255:19)
at Socket.emit (events.js:160:13)
at emitErrorNT (internal/streams/destroy.js:64:8)
at process._tickCallback (internal/process/next_tick.js:152:19)
name: 'MongoError',
message: 'failed to connect to server [localhost:27017] on first connect' }
✨ Done in 1.97s.
@nmaro I have the issue
I believe there's 2 ways you could face this problem
- Anti-virus or firewall blocking the MongoDB
Reference - MongoDB is not deployed yet on the
localhost:27017
OR choose to deploy it online instead to ease things up (offered by the official website, follow the steps and you will get the new mongo_url to be replaced).
MongoDB installation