0
D:\Others\HTML\login node\node_modules\mongojs\node_modules\mongodb\lib\utils.js:698
          throw error;
          ^

MongoServerSelectionError: connect ECONNREFUSED ::1:27017
    at Timeout._onTimeout (D:\Others\HTML\login node\node_modules\mongojs\node_modules\mongodb\lib\core\sdam\topology.js:438:30)
    at listOnTimeout (node:internal/timers:564:17)
    at process.processTimers (node:internal/timers:507:7)
Emitted 'error' event on Database instance at:
    at D:\Others\HTML\login node\node_modules\mongojs\lib\database.js:36:16
    at D:\Others\HTML\login node\node_modules\mongojs\node_modules\mongodb\lib\utils.js:695:9
    at D:\Others\HTML\login node\node_modules\mongojs\node_modules\mongodb\lib\mongo_client.js:285:23
    at connectCallback (D:\Others\HTML\login node\node_modules\mongojs\node_modules\mongodb\lib\operations\connect.js:367:5)
    at D:\Others\HTML\login node\node_modules\mongojs\node_modules\mongodb\lib\operations\connect.js:554:14
    at Object.connectHandler [as callback] (D:\Others\HTML\login node\node_modules\mongojs\node_modules\mongodb\lib\core\sdam\topology.js:286:11)
    at Timeout._onTimeout (D:\Others\HTML\login node\node_modules\mongojs\node_modules\mongodb\lib\core\sdam\topology.js:443:25)
    at listOnTimeout (node:internal/timers:564:17)
    at process.processTimers (node:internal/timers:507:7) {
  reason: TopologyDescription {
    type: 'Single',
    setName: null,
    maxSetVersion: null,
    maxElectionId: null,
    servers: Map(1) {
      'localhost:27017' => ServerDescription {
        address: 'localhost:27017',
        error: Error: connect ECONNREFUSED ::1:27017
            at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1300:16) {
          name: 'MongoNetworkError'
        },
        roundTripTime: -1,
        lastUpdateTime: 157429114,
        lastWriteDate: null,
        opTime: null,
        type: 'Unknown',
        topologyVersion: undefined,
        minWireVersion: 0,
        maxWireVersion: 0,
        hosts: [],
        passives: [],
        arbiters: [],
        tags: []
      }
    },
    stale: false,
    compatible: true,
    compatibilityError: null,
    logicalSessionTimeoutMinutes: null,
    heartbeatFrequencyMS: 10000,
    localThresholdMS: 15,
    commonWireVersion: null
  }
}

Node.js v18.12.1
[nodemon] app crashed - waiting for file changes before starting...

im new and i havent tried much i encounter this error whenever i try to psot details into the login page details are being forwarded through the localhost to the node server but the mongodb database is throwing error

how to correct this error anyone help

whats this error what does this even mean

  • It means you can't connect to your mongo server. You'll need to provide more details about where that server is and how it can be accessed. – deceze Dec 20 '22 at 15:18
  • No idea why this question has been closed. See https://stackoverflow.com/questions/74609210/cant-connect-to-mongodb-6-0-server-locally-using-nodejs-driver/74610881#74610881 – Wernfried Domscheit Dec 20 '22 at 15:34
  • @deceze The question is certainly not perfect but when you are familiar with MongoDB then you see in provided error messages immediately where the problem is and you can give an answer. – Wernfried Domscheit Dec 20 '22 at 15:43

0 Answers0