nickredmark / graphql-mongodb-example

Home Page:https://medium.com/the-ideal-system/graphql-and-mongodb-a-quick-example-34643e637e49

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

https://hub.docker.com/_/mongo/

@nmaro I have the issue
image

I believe there's 2 ways you could face this problem

  1. Anti-virus or firewall blocking the MongoDB
    Reference
  2. 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