-2

err = new ServerSelectionError(); ^

MongooseServerSelectionError: connect ECONNREFUSED ::1:27017 at _handleConnectionErrors (E:\woxaa\woxaa\server\node_modules\mongoose\lib\connection.js:755:11) at NativeConnection.openUri (E:\woxaa\woxaa\server\node_modules\mongoose\lib\connection.js:730:11) at runNextTicks (node:internal/process/task_queues:60:5) at listOnTimeout (node:internal/timers:538:9) at process.processTimers (node:internal/timers:512:7) { reason: TopologyDescription { type: 'Unknown', servers: Map(1) { 'localhost:27017' => ServerDescription { address: 'localhost:27017', type: 'Unknown', hosts: [], passives: [], arbiters: [], tags: {}, minWireVersion: 0, maxWireVersion: 0, roundTripTime: -1, lastUpdateTime: 67139425, lastWriteDate: 0, error: MongoNetworkError: connect ECONNREFUSED ::1:27017 at connectionFailureError (E:\woxaa\woxaa\server\node_modules\mongodb\lib\cmap\connect.js:383:20) at Socket. (E:\woxaa\woxaa\server\node_modules\mongodb\lib\cmap\connect.js:307:22) at Object.onceWrapper (node:events:628:26) at Socket.emit (node:events:513:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { cause: Error: connect ECONNREFUSED ::1:27017 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16) { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '::1', port: 27017 }, [Symbol(errorLabels)]: Set(1) { 'ResetPool' } }, topologyVersion: null, setName: null, setVersion: null, electionId: null, logicalSessionTimeoutMinutes: null, primary: null, me: null, '$clusterTime': null } }, stale: false, compatible: true, heartbeatFrequencyMS: 10000, localThresholdMS: 15, setName: null, maxElectionId: null, maxSetVersion: null, commonWireVersion: 0, logicalSessionTimeoutMinutes: null }, code: undefined }

how to handle this error

1 Answers1

0

connect ECONNREFUSED ::1:27017 suggests that the server at the address localhost:27017 refused the connection.

Some ideas why this could be happening

  • The MongoDB server is running on a different port or address. Check the MongoDB server configuration to make sure you are connecting to the correct address and port.
  • The MongoDB server is not running at all.
  • Firewall might be blocking the connection. Check any firewall or network security settings to make sure that the connection is allowed.
  • There might be an issue with MongoDB driver or configuration. Check your code and configuration to make sure that everything is set up correctly.
ErnestasL
  • 91
  • 2