Error while connecting mongodb

(node:20248) [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)
C:\Users\Patil\OneDrive\Desktop\markdown blog\node_modules\mongoose\lib\connection.js:825
const serverSelectionError = new ServerSelectionError();
^

MongooseServerSelectionError: connect ECONNREFUSED ::1:27017
at Connection.openUri (C:\Users\Patil\OneDrive\Desktop\markdown blog\node_modules\mongoose\lib\connection.js:825:32)
at C:\Users\Patil\OneDrive\Desktop\markdown blog\node_modules\mongoose\lib\index.js:409:10
at C:\Users\Patil\OneDrive\Desktop\markdown blog\node_modules\mongoose\lib\helpers\promiseOrCallback.js:41:5
at new Promise ()
at promiseOrCallback (C:\Users\Patil\OneDrive\Desktop\markdown blog\node_modules\mongoose\lib\helpers\promiseOrCallback.js:40:10)
at Mongoose._promiseOrCallback (C:\Users\Patil\OneDrive\Desktop\markdown blog\node_modules\mongoose\lib\index.js:1262:10)
at Mongoose.connect (C:\Users\Patil\OneDrive\Desktop\markdown blog\node_modules\mongoose\lib\index.js:408:20)
at Object. (C:\Users\Patil\OneDrive\Desktop\markdown blog\server.js:6:10)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions…js (node:internal/modules/cjs/loader:1213:10) {
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: 3399802,
lastWriteDate: 0,
error: MongoNetworkError: connect ECONNREFUSED ::1:27017
at connectionFailureError (C:\Users\Patil\OneDrive\Desktop\markdown blog\node_modules\mongodb\lib\cmap\connect.js:387:20)
at Socket. (C:\Users\Patil\OneDrive\Desktop\markdown blog\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
}

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

I am getting this type of error while connecting mongodb to node js. Please resolve the error…