0

PS D:\MERN project> npm start

ecommerce@1.0.0 start node backend/server.js

(node:19208) [MONGOOSE] DeprecationWarning: Mongoose: the `strictQuery` option will be switched back to `false` by default in Mongoose 7. Use `mongoose.set('strictQuery', false);` if you want to prepare for this change. Or use `mongoose.set('strictQuery', true);` to suppress this warning.   
(Use `node --trace-deprecation ...` to show where the warning was created)
Server is working on http://localhost:8000
D:\MERN project\node_modules\mongoose\lib\connection.js:825
  const serverSelectionError = new ServerSelectionError();
                               ^

MongooseServerSelectionError: connect ECONNREFUSED ::1:27017
    at Connection.openUri (D:\MERN project\node_modules\mongoose\lib\connection.js:825:32)
    at D:\MERN project\node_modules\mongoose\lib\index.js:411:10
    at D:\MERN project\node_modules\mongoose\lib\helpers\promiseOrCallback.js:41:5
    at new Promise (<anonymous>)
    at promiseOrCallback (D:\MERN project\node_modules\mongoose\lib\helpers\promiseOrCallback.js:40:10)
    at Mongoose._promiseOrCallback (D:\MERN project\node_modules\mongoose\lib\index.js:1285:10)
    at Mongoose.connect (D:\MERN project\node_modules\mongoose\lib\index.js:410:20)
    at connectDatabase (D:\MERN project\backend\config\database.js:5:6)
    at Object.<anonymous> (D:\MERN project\backend\server.js:11:1)
    at Module._compile (node:internal/modules/cjs/loader:1159:14) {
  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: 479784771,
        lastWriteDate: 0,
        error: MongoNetworkError: connect ECONNREFUSED ::1:27017
            at connectionFailureError (D:\MERN project\node_modules\mongodb\lib\cmap\connect.js:387:20)
            at Socket.<anonymous> (D:\MERN project\node_modules\mongodb\lib\cmap\connect.js:310: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:1300: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
}

getting error in mongoose while starting npm in terminalenter image description here

how to connect with mongodb compass

robertklep
  • 198,204
  • 35
  • 394
  • 381

0 Answers0