Hii team ,
i am learning backend and trying to use mongo on localhost . but is throwing error i attached image below . please help me and tell me why this error is coming and how i can avoid in feature this problem.
using window As OS, using nodejs 20v , and here is DB_URL : “mongodb://0.0.0.0/ecom_db”.`
Server started at 27017
Error in connecting to database
D:\vs code pratice\Backend pro\E-commerce\node_modules\mongoose\lib\connection.js:896
err = new ServerSelectionError();
^
MongooseServerSelectionError: connection <monitor> to 127.0.0.1:27017 closed
at _handleConnectionErrors (D:\vs code pratice\Backend pro\E-commerce\node_modules\mongoose\lib\connection.js:896:11)
at NativeConnection.openUri (D:\vs code pratice\Backend pro\E-commerce\node_modules\mongoose\lib\connection.js:847:11) {
reason: TopologyDescription {
type: 'Unknown',
servers: Map(1) {
'0.0.0.0:27017' => ServerDescription {
address: '0.0.0.0:27017',
type: 'Unknown',
hosts: [],
passives: [],
arbiters: [],
tags: {},
minWireVersion: 0,
maxWireVersion: 0,
roundTripTime: -1,
minRoundTripTime: 0,
lastUpdateTime: 160627453,
lastWriteDate: 0,
error: MongoNetworkError: connection <monitor> to 127.0.0.1:27017 closed
at Connection.onClose (D:\vs code pratice\Backend pro\E-commerce\node_modules\mongodb\lib\cmap\connection.js:109:22)
at Socket.emit (node:events:519:28)
at TCP.<anonymous> (node:net:338:12) {
[Symbol(errorLabels)]: Set(1) { 'ResetPool' },
[cause]: undefined
},
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
}