FrontendMasters / intro-to-graphql

[Course] Introduction to GraphQL
190 stars 289 forks source link

MongoError: topology was destroyed #4

Open nshaikhinurov opened 5 years ago

nshaikhinurov commented 5 years ago

When running test-schema script on branch lesson-2-solution with installed dependencies and mongod running in a terminal I have this error: Jest's output: Product schema › lesson-2: › Product has base fields

MongoError: topology was destroyed

  at createIndex (node_modules/mongodb/lib/operations/db_ops.js:289:21)
  at indexInformation (node_modules/mongodb/lib/operations/db_ops.js:424:7)
  at db.collection.listIndexes.toArray (node_modules/mongodb/lib/operations/db_ops.js:579:23)
  at err (node_modules/mongodb/lib/utils.js:415:14)
  at executeCallback (node_modules/mongodb/lib/utils.js:404:25)
  at handleCallback (node_modules/mongodb/lib/utils.js:128:55)
  at cursor._endSession.cursor._endSession (node_modules/mongodb/lib/operations/cursor_ops.js:220:38)
  at ClientSession.endSession (node_modules/mongodb-core/lib/sessions.js:113:43)
  at CommandCursor.Object.<anonymous>.Cursor._endSession (node_modules/mongodb-core/lib/cursor.js:190:13)
  at CommandCursor.Object.<anonymous>.Cursor._endSession (node_modules/mongodb/lib/cursor.js:226:59)
  at cursor._next (node_modules/mongodb/lib/operations/cursor_ops.js:220:20)
  at queryCallback (node_modules/mongodb-core/lib/cursor.js:660:23)
  at node_modules/mongodb-core/lib/connection/pool.js:532:18

$ mongod --version db version v4.0.5 git version: 3739429dd92b92d1b0ab120911a23d50bf03c412 allocator: tcmalloc modules: none build environment: distmod: 2008plus-ssl distarch: x86_64 target_arch: x86_64

What could be the suggestion for resolving this issue?

shindeajinkya commented 5 years ago

Replacing localhost to 127.0.0.1 in config folder to dev and testing file worked for me

MrSamsa42 commented 4 years ago

To be clear, change the dbUrl in dev.js to: 'mongodb://127.0.0.1:27017/api-design'

and change dbUrl in testing.js to: 'mongodb://127.0.0.1:27017/introgql-test'

sharazghouri commented 4 years ago

Replacing localhost to 127.0.0.1 in config folder to dev and testing file worked for me

Its work for me.